Quarto Conditional Blocks Custom Node API
In Quarto 1.3, conditional blocks are represented as a custom AST node. You can create conditional block AST nodes in Lua filters with the quarto.ConditionalBlock constructor. The constructor takes a single parameter, a table with entries node, behavior, and condition, as described below. In Lua filters, conditional blocks are represented as a table with the following fields:
- node: the div containing the content
- behavior: either- content-visibleor- content-hidden
- condition: a list of 2-element lists, such as- { { "unless-format", "html" } }(optional in the constructor, default value- {}). The first element of each sublist must be one of- when-format,- unless-format,- when-profile, and- unless-profile. The second element is the relevant format or profile.