有没有办法使用 pandoc 标记制作非 headers 锚链接
Is there a way to make non headers anchor links using pandoc markup
我正在尝试制作锚点 link,但只看到有关使用 headers 制作锚点 link 的参考资料。
# Header
Go and see the [Header](#header)
但是我想 link 列表中的特定单词。有没有办法给单个词一个锚点?
#. This phrase should be the anchor
Go and see number ([I.11](#this-phrase-should-be-the-anchor)
更新
最初的问题仍然没有运气。我想我可能不得不改用 headers 来重组我的文档,这并没有让我兴奋。我可能有一些文档有很深的小节,并且 html 不能超出 h6,但目前我会假设它们之间的距离很远。
我找到的唯一解决方案是 CSS,它可以修改 headers 以包含字母数字计数,这将使格式化比使用列表更好,因为我必须做一些时髦的 hack对于代码。这是可能的样子
body {
counter-reset: section;
}
h1 {
counter-reset: subsection;
}
h2 {
counter-reset: subsubsection;
}
h1:before {
counter-increment: section;
content: "" counter(section,upper-roman) ". ";
}
h2:before {
counter-increment: subsection;
content: counter(section,upper-alpha) " ";
}
/* So on and so forth according to individual need*/
<body>
<h1> First section </h1>
<h2>First Subsection</h2>
<p> Enterprise to Kirk </p>
<h2>Second Subsection</h2>
<p> Come in Enterprise</p>
<h2>Third Subsection</h2>
<p> We are under attack.</p>
<h1> Second section </h1>
<h2>First Subsection</h2>
<h2>Second Subsection</h2>
<h2>Third Subsection</h2>
</body>
我还学会了如何用 pandoc 附加一个 css 文件
添加 --css filepath.css 到命令行
您可以将 id
分配给具有 attributes in pandoc's internal AST (in newer pandoc versions this includes images and links) 的所有元素。
您也可以随时使用 divs or spans:
This is [a span]{#foo}
That can be [referenced with a link](#foo)
我正在尝试制作锚点 link,但只看到有关使用 headers 制作锚点 link 的参考资料。
# Header
Go and see the [Header](#header)
但是我想 link 列表中的特定单词。有没有办法给单个词一个锚点?
#. This phrase should be the anchor
Go and see number ([I.11](#this-phrase-should-be-the-anchor)
更新
最初的问题仍然没有运气。我想我可能不得不改用 headers 来重组我的文档,这并没有让我兴奋。我可能有一些文档有很深的小节,并且 html 不能超出 h6,但目前我会假设它们之间的距离很远。
我找到的唯一解决方案是 CSS,它可以修改 headers 以包含字母数字计数,这将使格式化比使用列表更好,因为我必须做一些时髦的 hack对于代码。这是可能的样子
body {
counter-reset: section;
}
h1 {
counter-reset: subsection;
}
h2 {
counter-reset: subsubsection;
}
h1:before {
counter-increment: section;
content: "" counter(section,upper-roman) ". ";
}
h2:before {
counter-increment: subsection;
content: counter(section,upper-alpha) " ";
}
/* So on and so forth according to individual need*/
<body>
<h1> First section </h1>
<h2>First Subsection</h2>
<p> Enterprise to Kirk </p>
<h2>Second Subsection</h2>
<p> Come in Enterprise</p>
<h2>Third Subsection</h2>
<p> We are under attack.</p>
<h1> Second section </h1>
<h2>First Subsection</h2>
<h2>Second Subsection</h2>
<h2>Third Subsection</h2>
</body>
我还学会了如何用 pandoc 附加一个 css 文件 添加 --css filepath.css 到命令行
您可以将 id
分配给具有 attributes in pandoc's internal AST (in newer pandoc versions this includes images and links) 的所有元素。
您也可以随时使用 divs or spans:
This is [a span]{#foo}
That can be [referenced with a link](#foo)