I have created two Pandoc templates to create HTML (using Bootstrap 5 with dark-mode, and Font Awesome) and PDF files using LuaLaTeX.
You can see the final results in this web and in the example.pdf.
If you want to see real books/html made with those templates here are more examples that I use as a teacher.
There are two templates, the first one to generate HTML and the other to create a custom PDF using LuaLaTeX.
Because I have created custom boxes/styles that doesn’t exists by default, I have created a filter to parse the initial markdown file to create the final HTML and LaTeX (to create the PDF).
template/filter.py: the Python filter. It needs Panflute package that makes Pandoc filters easy to use. Python is easier than Lua and Panflute allows some features (like pf.convert_text) that Lua filters cannot made by default.
template/filter.lua: DEPRECATED in 2026-07-17. This was the original filter, but was very difficult to add new features, and because Lua isn’t very friendly, I created the Python version. In near future I’ll delete this file.
The template is template/yuki.html, and it uses some files and dependencies from internet:
The template is template/yuki.tex, which is a modification from my custom old yukibook.cls class.
Copy the template/yuki.html and template/yuki.tex files into your ~/.pandoc/templates/ directory. Or you can use those templates cloning this repository.
To use custom features (like mycode, infobox, configdir, columns and tables …) see the 1.md and 2.md markdown files in raw format, to see how to use each feature.
In this repository there are few files to create an example HTML and PDF file:
To create the HTML file:
./book.sh | pandoc -o "example.html" -d defaults.yaml --verbose
If you want to create an embeded HTML file use the extra parameter --embed-resources=true.
To create the PDF file:
./book.sh | pandoc -o "example.pdf" -d defaults.yaml --template=template/yuki.tex --verbose
The --template=template/yuki.tex is needed because in the defaults.yaml the default filter is HTML file. Change the path if you have moved to other path.