Examples

Values from this very render.

The lua-env shortcode printing the Pandoc and Quarto state of the render that produced this page.

Every value below was read out of the render that produced this page. The filter is enabled in this site’s _quarto.yml:

filters:
  - lua-env

Pandoc

Pandoc globals, as this page was written.
Source Value
{{< lua-env pandoc.FORMAT >}}

html

{{< lua-env pandoc.PANDOC_VERSION >}}

3.10

{{< lua-env pandoc.PANDOC_API_VERSION >}}

1.23.1.2

Render the same document to another format and pandoc.FORMAT changes with it.

Quarto

The Quarto version that built this page.
Source Value
{{< lua-env quarto.version >}}

1.10.18

Through the meta shortcode

Everything sits under the lua-env metadata key as well, so Quarto’s own shortcode reaches it without the extension’s own:

The same value, read as ordinary metadata.
Source Value
{{< meta lua-env.pandoc.FORMAT >}}

html

Note

The two shortcodes are not interchangeable. meta prints scalars, and reports ?invalid meta type for anything else, so a path such as lua-env.quarto.version, which is a list of three numbers, needs the extension’s own shortcode.

Exporting to JSON

This site leaves the export off, since it would write host paths into a file the site then publishes:

extensions:
  lua-env:
    json: false

Turning it on writes lua-env.json beside the source document, so add it to .gitignore:

extensions:
  lua-env:
    json: true

Narrow it to what you actually want, and the file stays readable:

extensions:
  lua-env:
    json: true
    json-include:
      - pandoc.FORMAT
      - quarto.version

Or keep everything except one noisy branch:

extensions:
  lua-env:
    json: true
    json-exclude:
      - quarto._quarto
Warning

json-exclude-sensitive defaults to true and drops the input file, the output file, the project directories, and the Pandoc script path. Leave it on unless the file stays on your own machine.

Source

The repository ships a short, standalone starting point you can copy: example.qmd.

Back to top