python-sphinx - 在reStructuredText中,如何将内联文字放在超链接中?

标签 python-sphinx restructuredtext

在我的reStructuredText文档中,我定义了一个部分,如下所示:

Update the ``PATH`` Environment Variable
----------------------------------------


我想这样链接到本节:

* `Update the ``PATH`` Environment Variable`_


但是,当此代码呈现为HTML时,它看起来像这样:


更新``PATH`环境变量`


我真的希望环境变量PATH以字面样式显示,但是我对此很陌生。谁能帮我吗?

最佳答案

使用workaround,是的-可以(从@mzjn的comment暗示)。

例如:

.. |dummy| replace:: Update the ``PATH`` Environment Variable
.. _dummy:

Update the ``PATH`` Environment Variable
----------------------------------------

* |dummy|_


这是通过利用replace directive来实现的。

关于python-sphinx - 在reStructuredText中,如何将内联文字放在超链接中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34516306/

相关文章:

python - 在 Read The Docs 侧边栏中显示整个 toctree

python-sphinx - 重组文本中的不同字体大小

restructuredtext - reStructuredText 中的选项列表,用于不以破折号或斜杠为前缀的命令行参数

containers - 用容器替换狮身人面像

python-sphinx - MathJax 未在 Sphinx 中呈现

python - 覆盖 sphinx 的 autodoc 中的函数声明

python - Sphinx 自动文档与 Django 1.4

linux - 'make htmldocs'的安装和使用

python-sphinx - 是否可以用另一个指令替换一个指令

python - 自动摘要生成的文档缺少除 `__init__` 之外的所有 dunder 方法