pygments-mathematica looks awesome. Admittedly I still use
minted for $\LaTeX$ documents...
Anyway, I would like to add some Mathematica syntax highlighting for a few static webpages (built without Jekyll, Octopress, or whatever else there is).
At first I looked at and tried,
highlightjs.org. However the syntax highlighting for Mathematica is clearly worse than that of @rsmenon's (nor are there any
css files that resemble the Mathematica Notebook).
So following the instructions on the GitHub page:
pip install pygments-mathematica
for installation and then:
pygmentize -O full,style=mathematica -f html -l wl -o package.html package.m
While this did run without any errors, the results were not as expected.
Using the liquid tags method to see if I could just convert the code already in an
html file, I got:
which would not be so bad, if it didn't also convert the entire
html file into static text.
I then also tried code in a plain text file, from a notebook, and from a
.m file. The plain text file just spat out what I expected, which works, the notebook did not fair too well, and the package came out all commented...
I was just curious as to if there was a more verbose explanation as to how to use this page for webpages. Should I just copy-paste the code into a text file, run
pygments and then copy paste the result into the
Is there a way to run
html without having the
html affected, and only the liquid tagged code translated?
Following @R. M.♦ suggestion:
I downloaded the master branch from google/code-prettify and halirutan's Mathematica-Source-Highlighting.
Following the instructions on halirutan's
readme, I added the file
prettify-mms.min.css to the
Following google's demonstration, I source
and then use the appropriate tags:
<pre class="prettyprint lang-mma"> GetSampleRecord[dataset_Dataset] := First@Normal@First@dataset GetSampleRecord[dataset_List] := First@First@Rest@dataset (*Assumes the the first sublist is a list of column headers*) </pre>
However the color highlighting does not match that which is rendered by Mathematica Stack-exchange. What am I doing wrong?