As said and answered in this post , you can use SyntaxHighlighter for a short list of codes.
With ReStructuredText, I can use the raw directive as follows.
.. raw:: html <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script> <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script> <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCoreDefault.css"/> <script type="text/javascript">SyntaxHighlighter.all();</script> I could use `SyntaxHighlighter <http://alexgorbatchev.com/SyntaxHighlighter/>`_ for highlighting source code. .. raw:: html <pre class="brush: js;"> function helloSyntaxHighlighter() { return "hi!"; } </pre>
However, I need to have a code directive that I can use.
.. code:: function helloSyntaxHighlighter() { return "hi!"; }
How to convert code directive to the following HTML code?
<pre class="brush: js;"> function helloSyntaxHighlighter() { return "hi!"; } </pre>
source share