Pandoc plugin

This page was written in LibreOffice Writer and saved in ODT format. šŸ˜µā€šŸ’« Sounds like a 1st April joke, but it’s just to demonstrate possibilities of Pandoc plugin for Luasmith!

How to use

Use the module:

pandoc = require("pandoc")

And then add a node to your pipeline:

pandoc.processPandoc(pattern, options, contentSource)

All arguments are optional.

A formatting that will be exported to HTML completely depends on how Pandoc parses your document, so refer to Pandoc documentation (this page in particular has a very limited formatting because I didn’t bother to write custom filters or find another way, if it exists, to enrich ODT export; yet relative links work as expected).

Since it’s possible to add arguments to command-line, you can also use Lua filters for Pandoc (or simply modify luasmith-pandoc-filter.lua that comes along with the plugin and gets passed to Pandoc automatically).

Take a note that calling Pandoc as an external program for each page leads to a SEVERE increase of build time for your site compared to using built-in Markdown parser of Luasmith; it’s not the best idea to pass all your Markdown content to Pandoc if it can be processed using the built-in parser. For example, compiling Jared Krinke’s blog with built-in blog theme takes less than 500ms, but when using modified theme with Pandoc processing — almost 15 seconds!

For documents that can’t have metadata in a front-matter (like .odt files), you can write a separate metadata file and it will be automatically passed to Pandoc. This file must have the same name as your document but with .yaml extension (for example, this page is generated from pandoc.odt and pandoc.yaml with metadata next to it). If metadata file is not found, the plugin will try to read metadata from the document. In both cases metadata will be parsed by built-in Luasmith front-matter parser that has limited YAML support for now. Used metadata files will automatically be removed from Luasmith items list, so they won’t appear in your website.