如何使用 reStructuredText 在超链接目标中包含空格



我可以这样做:

For more info, see Target_.
.. _Target: http://google.com

这将正确生成Target链接到"http://google.com"的文档。

我想将目标替换为包含空格的文本:

For more info, see Text With Space_.
.. _Text With Space: http://google.com

上面的示例生成的文档错误地将"空间"链接到未知位置。 我希望它将"带空格的文本"链接到"http://google.com"。

我怎样才能做到这一点?

来自 Sphinx 文档的超链接,外部链接。

使用 Link text <http://example.com/> _ 作为内联 Web 链接。

`Link text <http://example.com/>`_

您还可以将链接和目标定义 (ref( 分开,如下所示:

This is a paragraph that contains `a link`_.
.. _a link: http://example.com/

你可以这样做:

.. |Target| replace:: Text With Space
.. _Target: http://google.com
For more info, see |Target|_

最新更新