smalldocs.shortcodes

Quarto’s shortcodes that make sense without Pandoc: include, meta, var, env and pagebreak.

lookup

source

lookup(data: dict, key: str) -> object

Find a dotted key in nested options.

Parameter Type Default Description
data dict required Nested options
key str required A dotted key, such as author.name
returns object The value, or None

expand

source

expand(text: str, here: Path, root: Path, meta: dict, warn: list[str], depth: int = 0) -> str

Replace the shortcodes in a page, outside code blocks.

Parameter Type Default Description
text str required Markdown that may hold shortcodes
here Path required The file it comes from, for include paths
root Path required The project’s root, for _variables.yml and paths from /
meta dict required The page’s options, for meta
warn list[str] required Where to note a shortcode that smalldocs does not know
depth int 0 How deep in includes we are, to stop a loop
returns str The text with the shortcodes replaced; code blocks are left alone