Typst.ts (cetz/fletcher/lilaq) for native typst diagram blocks #12439
Replies: 2 comments 2 replies
-
This would be a cool, worthwhile experiment, but it is a big feature, and I think you'd want to experiment with it first as a plain Lua filter. The syntax would not be that different. You'd use
And then write a Lua filter that catches CodeBlock with the |
Beta Was this translation helpful? Give feedback.
-
I also just realized that this behavior is pretty much exactly what Could be a helpful reference point, since even the syntax is pretty much exactly what I imagined. |
Beta Was this translation helpful? Give feedback.
-
Description
Currently typst is only used as a pdf-engine, but given it's web-native capabilities and tiny size, I think it makes a lot of sense to allow typst blocks the same way dot and tikz blocks are.
Typst can natively output svg, and has a lot fewer issues setting up than e.g. tikz (which is only supported right now in LaTeX output).
In addition, it's possible to use the Typst.ts CDN script to enable client-side rendering of arbitrary typst. This is the enabling tech behind the main LSP folks are using now (tinymist), and comes from the same dev.
I've tested out the static html example and it works incredibly well, live, with almost no latency, and no local typst installation. The docs seem to indicate the underlying mechanics of it are straightforward.
Not sure we necessarily need this since Quarto already vendors Typst, but it's an option.
Mostly I would like to use Typst as a super-portable, high-quality diagram block tool within quarto, so that the resulting SVGs can be used in my html, reveal.js, and latex/pdf documents.
Some example libraries that could easily be used for this:
and this is only the surface, there's more literally every day, lately. But I think it's really important to see this as possible SVG artifact generation for embedding into other formats, not just as a PDF engine.
Would we just need to add a handler for
typst.ts
in the/core/handlers/
dir?Beta Was this translation helpful? Give feedback.
All reactions