Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 731
ocelto Avatar asked Oct 30 '25 16:10

ocelto


1 Answers

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.

like image 190
tarleb Avatar answered Nov 01 '25 10:11

tarleb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!