Lua Environment
The Pandoc and Quarto Lua objects, as document metadata.
Quarto and Pandoc keep a good deal of state about a render: which format is being written, which file is being read, which version is running, what the reader and writer options are. All of it is reachable from a Lua filter, and none of it from the document you are writing.
lua-env copies that state into the document’s metadata. Once it has run, a value from the render environment can be printed with a shortcode, the same way any other metadata is, and optionally written out as JSON.
Installation
quarto add mcanouil/quarto-lua-env@1.6.0This will install the extension under the _extensions subdirectory. If you are using version control, you will want to check in this directory.
Or install it from your editor with Quarto Wizard:
Quick start
The filter has to be enabled before the shortcode has anything to read:
filters:
- lua-envThen name a value by its dot-separated path:
{{< lua-env pandoc.FORMAT >}}This page renders to html, under Pandoc 3.10.
The same values are reachable through Quarto’s own meta shortcode, under the lua-env key:
{{< meta lua-env.pandoc.FORMAT >}}See the Reference for every option and every path, and the Examples for values printed live.
Where it works
Every output format. The values differ by format, which is rather the point: pandoc.FORMAT is html here and latex in a PDF.
Links
- Reference for the full option list.
- Examples for values from this render.
- Changelog for what each release changed.
- Source and issues on GitHub.