ocelto
ocelto

Reputation: 43

Lua filter for pandoc to append html

I'm currently compiling markdown to html using pandoc:

    pandoc in.md -o out.html

and would like to include the same piece of html code in each of the output files, without having to write it into my markdown file.

I was hoping that a lua filter would do the job. However, the docs seem to indicate the filters will only respond to a sequence of characters within my markdown file, rather than appending something to each file.

I've played around with CSS (I've never used it before), but it doesn't look like I can just add arbitrary html code like this (correct me if I'm wrong).

To summarize, I'd like to find a way to add html code to my output.

Upvotes: 4

Views: 650

Answers (1)

tarleb
tarleb

Reputation: 22689

A Lua filter is likely to be overkill here. Pandoc has an option --include-after-body (or --include-before-body) which will do what you need:

-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.

Upvotes: 2

Related Questions