作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 rst 文件中有以下内容:
.. code-block:: bash
user@adi:~/workspace$ pytest
test/test/functional/example/test_api_2.py
--testbed test/test/topo_confs/pytest_tb.json
--loglevel DEBUG --html /home/user/test.html --self-contained-html
最佳答案
.. 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
user@adi:~/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
关于python-sphinx - 如果可能,我们如何在 rst 文件的代码部分中放置超链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45499108/
我是一名优秀的程序员,十分优秀!