有没有办法使用pandoc标记

时间:2016-07-15 15:55:09

标签: anchor pandoc

我正在尝试创建一个锚链接,但只能看到使用标题创建锚链接的引用。

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

但是我想链接列表中的特定单词。有没有办法给一个单词一个锚?

#. This phrase should be the anchor
Go and see number ([I.11](#this-phrase-should-be-the-anchor)

更新

原始问题仍然没有运气。我想我可能不得不用标题来解决我的文档重组问题,这并不能激发我的兴趣。我可能有一些文章有很深的子章节,而html不能超越h6,但目前我会假设它们之间的距离很远很少。

我找到的唯一解决方案是CSS可以修改标题以包含字母数字计算,这将使格式化比使用列表更好,因为我必须为代码做一些时髦的黑客攻击。这可能是什么样的

    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添加到命令行

1 个答案:

答案 0 :(得分:3)

您可以使用attributes in pandoc's internal AST为所有元素分配id(在较新的pandoc版本中,这包括images and links)。

您也可以始终使用:<span id="foo">my text</span> that can be [referenced](#foo).

相关问题