Lua 过滤 pandoc 以附加 html

Lua filter for pandoc to append html

我目前正在使用 pandoc 将 markdown 编译为 html:

    pandoc in.md -o out.html

并希望在每个输出文件中包含相同的 html 代码,而不必将其写入我的 markdown 文件。

我希望 lua 过滤器可以完成这项工作。但是,文档似乎表明过滤器只会响应我的降价文件中的一系列字符,而不是向每个文件附加一些内容。

我玩过 CSS(我以前从未使用过),但看起来我不能像这样添加任意 html 代码(如果我错了)。

总而言之,我想找到一种方法将 html 代码添加到我的输出中。

Lua 过滤器在这里可能有点矫枉过正。 Pandoc 有一个选项 --include-after-body(或 --include-before-body),它将满足您的需要:

-A FILE, --include-after-body=FILE|URL

Include contents of FILE, verbatim, at the end of the document body (before the </body> tag in HTML, or the \end{document} command in LaTeX). This option can be used repeatedly to include multiple files. They will be included in the order specified. Implies --standalone.