How to deal with duplicate target names in reStructuredText?

你离开我真会死。 提交于 2019-12-03 16:34:04

Option one

As @mzjn pointed out, make target name more clear:

`Download foo`_

.. _Download foo: http://example.com/foo

`Download bar`_

.. _Download bar: http://example.com/bar

Option two

From docutils-user maillist:

Use Anonymous hyperlink:

Download__


__ http://example.com/foo


Download__

__ http://example.com/bar

As far as I can tell from the documentation, reference names in ReST documents share a common namespace, so they must be unique. I can't think of anything better than this:

foo is a tool used to do foo.

`Download foo`_

.. _Download foo: http://example.com/foo

blah blah blah (omit a lot of paragraphs)

bar is another tool to do bar.

`Download bar`_

.. _Download bar: http://example.com/bar
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!