GitHub doesn't auto-detect and color Mathematica code in its markdown. Can we make it do so?
This may be trivial, but many README files don't seem to have it.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityIt seems to have been possible at least since March 16th 2016 and probably earlier (thanks to jkuczm) I found it here (cannot remember how I ended up there). Here's another example using it.
If we look at how that works, though, we see this:
```Mathematica
Manipulate[
Module[{
r1=ClassVRadius[t1],
r2=ClassVRadius[t2],
r3=ClassVRadius[t3],
r4=ClassVRadius[t4],
r5=ClassVRadius[t5],
r6=ClassVRadius[t6],
r7=ClassVRadius[t7]},
Graphics3D[{
{ColorData["B...
etc.
```
And so just sticking your code in a block like that headed by Mathematica does it. I suppose this should have been obvious. But maybe it's good to have it here for those of use who only use GitHub sparingly.
I used this trick here. Admittedly, the highlighting is poorly implemented and the colors are garish, but it's fun, at the very least. And maybe GitHub will improve it some day.
One caveat: As Szabolcs notes, this is not necessarily assured to work on other Markdown-using sites.
Get
) $\endgroup$