【问题标题】:Link the same text to different targets in reStructuredText将相同文本链接到 reStructuredText 中的不同目标
【发布时间】:2017-04-10 12:46:45
【问题描述】:

如何使两个链接在 reStructuredText 中具有相同的文本但目标不同?以下脚本不起作用,但可以帮助您理解重点:

This Python_ is not the same as that Python_.

.. _Python2: https://docs.python.org/2/
.. _Python3: https://docs.python.org/3/

这个工作可以在 Markdown 中完成:

This [Python][Python2] is not the same as that [Python][Python3].

[Python2]: https://docs.python.org/2/
[Python3]: https://docs.python.org/3/

结果:

这个Python和那个Python不一样。

【问题讨论】:

    标签: markdown restructuredtext


    【解决方案1】:

    更好的解决方案:

    This `Python <Python2_>`_ is not the same as that `Python <Python3_>`_.
    
    .. _Python2: https://docs.python.org/2/
    .. _Python3: https://docs.python.org/3/
    

    找到了带有指令和替代的解决方案。不确定这是否是最好的。

    This |Python2|_ is not the same as that |Python3|_.
    
    .. |Python2| replace:: Python
    .. |Python3| replace:: Python
    .. _Python2: https://docs.python.org/2/
    .. _Python3: https://docs.python.org/3/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-22
      • 1970-01-01
      • 1970-01-01
      • 2018-06-21
      • 2012-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多