smalldocs.shortcodes

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

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

arguments

source

arguments(text: str) -> tuple[list[str], dict[str, str]]

Split a shortcode’s arguments, with quotes as in a shell.

Parameter Type Default Description
text str required What follows the shortcode’s name, such as Shift-Ctrl-P mac=Shift-Command-P
returns tuple[list[str], dict[str, str]] The plain arguments, and the key=value ones

kbd

source

kbd(text: str, count: list[int]) -> str

Show keys to press, as Quarto’s kbd shortcode, with the keys for each system in the title.

Parameter Type Default Description
text str required The arguments: the keys, then mac=, win= and linux= for each system
count list[int] required Not used
returns str Quarto’s markup: a <kbd>, and the keys again for screen readers

video

source

video(text: str, count: list[int]) -> str

Embed a video, as Quarto’s video shortcode.

Parameter Type Default Description
text str required The arguments: the address or the file, then title, width, height, aspect-ratio and start
count list[int] required How many videos the page has so far; this one adds one
returns str Quarto’s markup: an embedded player for YouTube, Vimeo and Brightcove, else a <video>

lipsum

source

lipsum(text: str, count: list[int]) -> str

Write placeholder text, as Quarto’s lipsum shortcode.

Parameter Type Default Description
text str required The arguments: how many paragraphs, such as 2, or a range, such as 1-3
count list[int] required Not used
returns str Paragraphs of placeholder text

placeholder

source

placeholder(text: str, count: list[int]) -> str

Draw a grey box of a given size, as Quarto’s placeholder shortcode, without a call to a web service.

Parameter Type Default Description
text str required The arguments: the width, and the height, which is the width when it is missing
count list[int] required Not used
returns str An <img> of a grey box, drawn as SVG in the page

expand

source

expand(text: str, here: Path, root: Path, meta: dict, warn: list[str], depth: int = 0, count: list[int] | None = None) -> 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
count list[int] | None None How many videos the page has so far, shared with its includes
returns str The text with the shortcodes replaced; code blocks are left alone