In docutils 0.9 and 0.10 it is not suitable for using code, code or source code. All directives are considered the role of code .
This command generates css, which can be embedded in html via rst2html.py.
pygmentize -S default -f html -a .code > syntax.css
This command will create html:
rst2html.py --stylesheet=syntax.css in.txt > out.html
By default, rst2html.py displays gaps with class names such as comment , number , integer and operator . If you have docutils.conf in the same directory as the source, or /etc or in ~/.docutils with
[parsers] [restructuredtext parser] syntax_highlight=short
... then the class names will be c , m , mi and o , which correspond to the syntax.css generated by pygmentize .
See syntax highlighting in docutils documentation
source share