Skip to content

[enhancement:mdbook-typst-pdf] Render admonish icons in PDF output #4

Description

@padamson

Context

Admonish blocks now render as styled Typst blocks with colored left borders and bold titles in PDF output (KaiserY/mdbook-typst-pdf#11). However, the type-specific icons (note, tip, warning, etc.) are not rendered.

Why icons are hard

  • Built-in mdbook-admonish icons are embedded as CSS background-image data URIs — not standalone files accessible to the typst-pdf backend
  • Custom icons (like our reference type's book-open-variant.svg) are configured in book.toml under [preprocessor.admonish], which the typst-pdf backend doesn't read
  • Bundling SVG copies of default icons in the crate adds maintenance burden

Current behavior

Admonish blocks render with colored left border + bold title. No icon.

Expected behavior

Each admonish type displays its icon (or a Unicode fallback) next to the title.

Possible approaches

  • Bundle default admonish SVGs and emit #image() in the Typst block
  • Read [preprocessor.admonish] config from book.toml for custom icon paths
  • Use Unicode symbol fallbacks (e.g., ℹ️ for info, ⚠️ for warning)

Priority

Low — colored borders and bold titles provide sufficient visual differentiation for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions