2017-08-04 13 views

回答

0

.. code-block::仅适用语法高亮显示字面代码,这意味着它不通过解释reStructuredText的标记支持超链接。

相反,您可以在Sphinx主题的CSS文件中使用自定义样式,比如名为my-code-block,并使用reST标记,如下所示。

在你的CSS文件:

p.my-code-block { 
    font-family: monospace; 
    white-space: pre; 
} 

而且在你的休息源文件:

.. rst-class:: my-code-block 

    [email protected]:~/workspace$ pytest 
    test/test/functional/example/test_api_2.py 
    --testbed test/test/topo_confs/`pytest_tb.json <relative/path/to/pytest_tb.json>`_ 
    --loglevel DEBUG --html /home/user/test.html --self-contained-html 

注意,将不适用的bash从语法高亮Pygments来做。但是你可以得到花哨和HTML输出使用JavaScript语法高亮,但得到的HTML输出到什么JavaScript的需要以及更新的主题可以是具有挑战性和更多的麻烦比它的价值符合。

相关问题