本文介绍了如何处理 reStructuredText 中重复的目标名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
示例:
foo is a tool used to do foo.
Download_
.. _Download: http://example.com/foo
blah blah blah (omit a lot of paragraphs)
bar is another tool to do bar.
Download_
.. _Download: http://example.com/bar
由于Download
指向不同的url,docutilus给出了这个错误报告:
Since Download
points to different urls, docutilus gives this error report:
Duplicate target name, cannot be used as a
unique reference: "Download".
在markdown中,我可以为这两个Download
指定不同的id:
While in markdown, I can specify different id for this two Download
:
[Download][download-foo]
[download-foo]: http://example.com/foo
[Download][download-bar]
[download-bar]: http://example.com/bar
如何在 reStructuredText 中做类似的事情?
How can I do similar things in reStructuredText?
推荐答案
方案一
正如@mzjn 指出的,让目标名称更清晰:
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
选项二
来自 docutils 用户邮件列表:
使用匿名超链接:
Download__
__ http://example.com/foo
Download__
__ http://example.com/bar
这篇关于如何处理 reStructuredText 中重复的目标名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!