Skip to content

Allow switching the math typesetter (KaTeX / Typst) in settings #428

Closed

Description

@satwikShresth

Description:

Currently, math blocks wrapped in $$ $$ always trigger the KaTeX renderer. It would be nice to let users choose Typst as an alternative math typesetter through a settings option.

Current behavior:
Math inside $$ $$ is always rendered with KaTeX, with no way to switch.

Proposed behavior:
Add a settings toggle (e.g. "Math Renderer": KaTeX / Typst) that lets users pick which typesetter is used to render $$ $$ blocks. When set to Typst, math blocks should render using the Typst math renderer instead of KaTeX.

Why:
Some users may prefer Typst's math syntax and output style over KaTeX, and having this as a configurable option makes Zennotes more flexible without breaking existing KaTeX behavior for everyone else.

Scope:
This is a small, self contained change: add a settings field and branch the renderer choice at the point where $$ $$ blocks are processed. No changes needed to note storage format.

Activity

  1. adibhanna commented on Jul 20, 2026

    @adibhanna
    Contributor

    Shipped on the v2.15.0 branch in 80b1691.

    Settings ▸ Editor ▸ Math renderer now switches $…$ / $$…$$ typesetting between KaTeX (default) and Typst, applied in both the live editor and the reading view. Typst reads the blocks as Typst markup rather than LaTeX, so $ integral_0^1 x^2 dif x = 1/3 $ and $ mat(1, 2; 3, 4) $ render as expected, and each note's math is written for whichever engine you pick.

    A few notes on the implementation:

    • The whole Typst toolchain (compiler + renderer WASM and the New Computer Modern fonts) is bundled and renders fully offline; nothing is fetched from a CDN.
    • It is lazily loaded, so users who stay on KaTeX pay nothing at startup.
    • Output pins New Computer Modern, so it matches KaTeX's classic Computer Modern look. Block equations get the same display card as KaTeX, and clicking a rendered block opens it for editing.
    • KaTeX stays the default, so existing notes are unaffected.

    There's also a 'Prefer Typst?' section in the built-in demo tour showing how to switch and what Typst syntax looks like.

    Thanks for the clear, well-scoped request, @satwikShresth!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions