Reference
Every prefix the prism extension recognises.
Enabling the filter
filters:
- prismSyntax
An attribute key is format:name, and its value is used as name when format matches.
| Pattern | Behaviour |
|---|---|
format:name="…" |
Becomes name="…" when format matches the active format; dropped otherwise. |
slide:name="…" |
Becomes name="…" under revealjs, slidy, s5, dzslides, and slideous. |
default:name="…" |
Used only when no format-specific variant of name matched. |
name="…" |
Passed through unchanged, unless a higher-ranked entry sets the same name. |
.class |
Untouched. |
#identifier |
Untouched. |
It applies to divs, spans, headings, and code blocks.
Which prefix matches which format
The prefix is matched exactly against the format Quarto is targeting, resolved through quarto.format.format_identifier().
| Active format | Matching prefix |
|---|---|
html |
html: |
revealjs |
revealjs: |
typst |
typst: |
pdf |
pdf: |
latex, when the target is .tex rather than PDF |
latex: |
beamer |
beamer: |
docx |
docx: |
pptx |
pptx: |
A custom format, say mcanouil-typst |
mcanouil-typst: |
A custom format is distinct from the writer beneath it. Under mcanouil-typst only mcanouil-typst: matches, not typst:, and the other way round.
The same holds for pdf and latex, which are two Quarto formats over one writer: format: pdf matches pdf: alone, and latex: matches only when the target is latex, the format that stops at .tex.
Pandoc’s Typst writer reads typst:-prefixed attributes of its own, and prism leaves those alone in a Typst render rather than promoting them.
On a div, typst:text:<property> becomes #set text(<property>: …) and typst:<parameter> becomes an argument to #block(), for the thirteen parameters Typst’s block() accepts: width, height, breakable, fill, stroke, radius, inset, outset, spacing, above, below, clip, and sticky. On a span only typst:text:<property> is read, wrapping the content in #text(…). Those reach the writer untouched, so the two namespaces coexist on one element.
The writer reads nothing on a code block or a heading, and no single-level key on a span, so prism promotes those as it always has. The Typst property output reference is the authority on what it reads.
Any other typst: key is prism’s, because the writer splices it into #block() unvalidated and Typst then rejects it: typst:style on its own fails the render with unexpected argument: style. Prefixing it hands it to prism, which strips the prefix so that Quarto’s own CSS translation picks it up:
::: {typst:style="color: rgb(0,0,255);" typst:text:size="20pt"}
Blue and large in Typst output alone.
:::color, background-color, font-family, font-size, font-weight, and font-style are the properties Quarto carries across to Typst.
Outside a Typst render a typst: key is dropped as any other non-matching prefix is.
Precedence
For one attribute name on one element:
| Rank | Source | Example |
|---|---|---|
| 1 | An exact format match. | html:style under html. |
| 2 | A group alias. | slide:style under revealjs. |
| 3 | The default: fallback. |
default:style. |
| 4 | An unprefixed attribute. | style. |
Two entries of the same rank for the same name, two html:style keys for instance, resolve to the last one written.
An unprefixed attribute is dropped when anything higher-ranked resolves to the same name, so an element never carries the same attribute twice and Pandoc never warns about it.
Promoted attributes are written after the unprefixed ones that survive, in the order their target names first appeared.
Options
extensions:
prism:
warn-on-drop: true| Option | Type | Default | Description |
|---|---|---|---|
warn-on-drop |
boolean | false |
Warn each time a format-scoped attribute is dropped because nothing matched. |
A prefix is known when it is an exact format name, a group alias, or default. Anything else is treated as a format that is not active, and the attribute is dropped in silence.
That is deliberate, since a format of that name would resolve it later, but it also hides a typo such as revaeljs:style. warn-on-drop is how you find those:
(W) [prism] Dropped attribute(s) 'revaeljs:style' on #mybox because no prefix matched target format 'revealjs'.Limitations
- The prefix must match the format name exactly; there is no partial or base-writer matching. The one exception is the reserved
typst:set above, which is recognised whenever Pandoc writes Typst, including under a custom format such asmcanouil-typst. slideis the only group alias.- An unknown prefix is indistinguishable from an inactive format, which is why
warn-on-dropexists. - On a div, a
typst:key naming ablock()parameter belongs to Pandoc, sotypst:widthsets a block width rather than promoting awidthattribute. There is no way to promote it instead, and none is needed: the writer drops a plain attribute, so a promotedwidthwould reach no consumer.