One thing that is nice about Prism is that it provides hooks to extend the syntax highlighting, so it is straightforward to create a plugin that adds features like my line numbering, so I can do things like:
Download the CSS (the linenumbering parts are at the bottom).
You use the plugin simply by including the script after loading Prism, then adding the
data-linenumber attribute to the
code element, as in
0 (we're computer scientists after all!). Change it by assigning a value to the
data-linenumber attribute, as in
As I discussed before, the
code element must have a style of
counter-reset: something and each line is wrapped in a
<span class="line"> element, and those must have a style of
counter-increment: something. Then the
span.line:before selector needs a style of
Hope this helps someone!.