如何处理 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 会给出以下错误报告:
Duplicate target name, cannot be used as a
unique reference: "Download".
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
How can I do like things in重构文本?
Example:
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
Since Download
points to different urls, docutilus gives this error report:
Duplicate target name, cannot be used as a
unique reference: "Download".
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
How can I do similar things in reStructuredText?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
选项一
正如@mzjn指出的那样,使目标名称更清晰:
选项二
来自 docutils -用户邮件列表:
使用匿名超链接:
Option one
As @mzjn pointed out, make target name more clear:
Option two
From docutils-user maillist:
Use Anonymous hyperlink:
据我所知文档,参考ReST 文档中的名称共享公共命名空间,因此它们必须是唯一的。我想不出比这更好的事情了:
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: