gpt4 book ai didi

anchor - 有没有办法使用 pandoc 标记制作非标题 anchor 链接

转载 作者:行者123 更新时间:2023-12-04 12:18:53 25 4
gpt4 key购买 nike

我正在尝试制作一个 anchor 链接,但只能看到使用标题制作 anchor 链接的引用。

# Header
Go and see the [Header](#header)

但是我想链接列表中的特定单词。有没有办法给一个词一个 anchor ?
#. This phrase should be the anchor
Go and see number ([I.11](#this-phrase-should-be-the-anchor)

更新

原始问题仍然没有运气。我想我可能不得不用标题来重组我的文档,这并不让我兴奋。我可能有一些文档有很深的小节,而 html 不能超过 h6,但目前我会假设它们之间相差甚远。

我找到的唯一解决方案是一个 CSS,它可以修改标题以包含字母数字数字,这将使格式化比使用列表更好,因为我必须对代码进行一些时髦的 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 的元素(在较新的 pandoc 版本中,这包括 images and links )。
您也可以随时使用 divs or spans还有:

This is [a span]{#foo}

That can be [referenced with a link](#foo)

关于anchor - 有没有办法使用 pandoc 标记制作非标题 anchor 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38400423/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com