当我对我的ReStructured Text源运行rst2html.py时,使用它的代码块指令,它将所有的跨度和类添加到
HTML中的代码位,但是实际着色这些跨度的CSS是不存在的.是否可以让RST添加CSS链接或将CSS嵌入HTML文件中?
解决方法
从Docutils 0.9开始,您可以使用
code
directive.从此页面上的示例:
@H_502_6@.. code:: python
def my_function():
"just a test"
print 8/2
或者,您可以使用Pygments进行语法突出显示.见答案Using Pygments in ReST documents和this.
最后,您还可以使用this或this blogpost中的代码.
更新如评论中所述,要获取Pygments使用的样式文件,请使用该命令
@H_502_6@pygmentize -S default -f html -a .highlight > style.css