Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Pass the callout type and appearance to the Typst callout() function #15414

Open

Description

@mcanouil

Description

In Typst output, Quarto calls callout() with body, title, background_color, icon_color, icon and body_background_color.
It does not pass the callout type (note, tip, warning, important, caution) or the appearance (default, simple, minimal).

A template or an extension can redefine callout() to restyle callouts.
Without the type, it can only guess the type from the colours.
That guess breaks as soon as a _brand.yml changes the colours, which is the case in #14092.
Without the appearance, a redefined callout() cannot draw a minimal callout differently from a simple one.

For example, a format extension that draws each callout type with its own glyph and its own colour token today needs a filter that runs before Quarto.
That filter puts a hidden marker with the type in each callout body, and the Typst function reads the marker and removes it.

Both values are known in src/resources/filters/customnodes/callout.lua when the call is built.
The type is callout.type.
The appearance needs a little care, because the Callout constructor turns minimal into simple with no icon, so the raw value has to be kept for the call.
Could callout() receive them as two more named arguments, for example kind: "warning" and appearance: "minimal"?
The default callout() in definitions.typ can accept and ignore them.
The cross-referenced callout path builds the same call and would pass them too.

Seen with Quarto 1.12.3.

Impact on extensions

Typst rejects a named argument the function does not declare.
So an override of callout() keeps working only if it accepts ..args.
I checked the extensions in the quarto-extensions index that target Typst or mention callouts.
These overrides would fail on every callout once Quarto passes the new arguments:

The tufte-inspired and christopherkenny/tufte copies don't declare body_background_color either, so they may already fail today.

These overrides already accept extra arguments, and two of them guess the type today:

  • maucejo/quarto-bookly matches on the title text.
  • mvuorre/quarto-preprint matches on the note colour or the brand primary colour.
  • coatless-quarto/custom-callout and mcanouil/quarto-mcanouil forward ..args.

I'd still pass the two arguments, and add a changelog note that asks template authors to accept ..args in callout().
body_background_color was added the same way.

Activity

  1. added
    enhancement
    callouts
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    calloutsenhancementtypst

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions