Lua filter changes

Pre-release Feature

This feature is new in the upcoming Quarto 1.4 release. To use the feature now, you’ll need to download and install the Quarto pre-release.

Quarto v1.4 includes the following new features for Lua filters:

Relative paths in require() calls

In larger, more complex filters, it becomes useful to structure your Lua code in modules. Quarto v1.4 supports the use of relative paths in require() calls so that small modules can be easily created and reused.

For example:

filter.lua
local utility = require('./utils')
function Pandoc(doc)
  -- process 
end

Using relative paths this way in quarto makes it harder for multiple filters to accidentally create conflicting module names (as would eventually happen when using the standard Lua require('utils') syntax). It’s possible to refer to subdirectories and parent directories as well:

filter2.lua
local parsing = require('./utils/parsing')
function Pandoc(doc)
  -- process 
end
utils/parsing.lua
local utils = require("../utils")
-- ...