我正在尝试使用内部引用将我的 wiki 页面顶部的索引与文档中的多个部分链接起来。这是一个例子:
* `My index`_
+ Foreword_
+ `Technical details`_
My index
--------
Foreword
~~~~~~~~
Technical details
~~~~~~~~~~~~~~~~~
如果我通过rest2html 生成HTML 页面,我会得到正确的结果。然而,GitHub wiki 在引用文献中插入了额外的单词,并且链接不起作用。例如:
https://github.com/myaccount/myproject/wiki/Page#wiki-my-index
https://github.com/myaccount/myproject/wiki/Page#wiki-foreword
https://github.com/myaccount/myproject/wiki/Page#wiki-technical-details
我在 GitHub 页面中找不到任何相关文档,所以我有点迷失了。
最佳答案
生成的 div 中似乎缺少类 ID。检查页面源以(不)看到它们。我认为它应该是这样的:
<ul>
<li><dl class="first docutils">
<dt><a class="reference internal" href="#my-index">My index</a></dt>
<li><a class="reference internal" href="#foreword">Foreword</a></li>
<li><a class="reference internal" href="#technical-details">Technical details</a></li>
</ul>
<div class="section" id="my-index">
<h1>My index</h1>
</div>
<div class="section" id="foreword">
<h2>Foreword</h2>
</div>
<div class="section" id="technical-details">
<h2>Technical details</h2>
</div>
编辑:用户凭直觉在 a GitHub markup issue 中提到了同样的问题
I've noticed this problem with README.rst files as well. As well as headings, inline targets in .rst files, e.g. _
some target
, don't work. The inline target text gets wrapped in a but doesn't get made into any sort of link target. Should I file this as a separate issue?
关于github - 使用 GitHub wiki 中的引用和重构文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9672049/