完全等同于 :ref:

问题描述

以下 ReStructuredText 包含 :ref: 角色,它是一个 Sphinx 扩展:

Read more in :ref:`section-target`.

.. _section-target:

Section Title
=============
Text body.

哪里

:ref:`section-target`

被解析为以下文档树:

<reference internal="True" refid="section-target"><inline classes="std std-ref">Section Title</inline></reference>

您可以通过将上述 reStructuredText 存储到 sphinx_input/index.rst 中并运行 sphinx-build -b xml -C sphinx_input sphinx_ouptut 来重现这一点。

是否有等价物可用于生成仅使用 docutils restructuredtext 的完全相同的文档树? (因此没有 Sphinx 特定的角色或指令)。我不关心可读性,因为这只会被机器解析。

到目前为止,我得到的最接近的是:

`Section Title <section-target>`_

导致:

<reference name="Section Title" refuri="section-target">Section Title</reference>

这很接近,但它定义了一个 refuri,而不是一个 refid

很遗憾,缺少 documentation of the reference doctree

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)