Python sphinx 如何在StructuredText中的内联文字中包含超链接引用?

Python sphinx 如何在StructuredText中的内联文字中包含超链接引用?,python-sphinx,restructuredtext,Python Sphinx,Restructuredtext,我将Sphinx与StructuredText一起使用,我希望在内联文本中包含一个超链接。然而,可以预见的是,如果我写 The result has type ``Foo_ -> Bar_``. .. _Foo: Information about ``Foo``. .. _Bar: Information about ``Bar``. 然后,Foo_和Bar_不会变成超链接。如果我将文档更改为使用已解析的文本块 The result has type: .. parsed-l

我将Sphinx与StructuredText一起使用,我希望在内联文本中包含一个超链接。然而,可以预见的是,如果我写

The result has type ``Foo_ -> Bar_``.

.. _Foo:

Information about ``Foo``.

.. _Bar:

Information about ``Bar``.
然后,
Foo_
Bar_
不会变成超链接。如果我将文档更改为使用
已解析的文本

The result has type:

.. parsed-literal::

    Foo_ -> Bar_

然后我得到我想要的超链接。然而,我不想要一个单独的块——我希望代码是内联的。有什么方法可以做到这一点吗?

你可以通过替换非常接近

.. |Foo| replace:: ``Foo``
.. |Bar| replace:: ``Bar`` 

The result has type |Foo|_ ``->`` |Bar|_.

.. _Foo:

Information about ``Foo``.

.. _Bar:

Information about ``Bar``.
这是受以下所述嵌套内联标记的解决方案启发的:

另请参见。

另请参见