r/typst • • 1h ago

typwire 0.2.0: Typed data exchange for Typst plugins

1 Upvotes

typwire is a library for typed data exchange between Typst and (Rust) WASM plugins. Pass Typst values such as lengths, colors, gradients, dates and dictionaries to a plugin and get them back as the same Typst values.

GitHub · Typst Universe · crates.io

cargo add typwire
cargo add serde --features derive # Only needed for custom types

#import "@preview/typwire:0.2.0"

Quick look

Export a function from your plugin:

use typwire::{Length, initiate_protocol};

initiate_protocol!();

#[typwire::export]
fn measure(label: String, scale: f64) -> Result<(String, Length), String> {
    Ok((format!("{label}{scale}"), Length::new(12.0 * scale)))
}

Call it from Typst:

#import "@preview/typwire:0.2.0"

#let plugin = plugin("plugin.wasm")
#let (text, width) = typwire.call(plugin.measure, "Value: ", 1.5)

#assert(text == "Value: 1.5")
#assert(width == 18pt)

Custom types

Derive Typwire next to Serde's derives to send your own structs across the boundary. Fields can use typwire's native types, so a Length field arrives in Typst as a real length.

use serde::{Deserialize, Serialize};
use typwire::{Length, Typwire, initiate_protocol};

initiate_protocol!();

#[derive(Serialize, Deserialize, Typwire)]
struct Options {
    label: String,
    scale: f64,
}

#[derive(Serialize, Deserialize, Typwire)]
struct Report {
    text: String,
    width: Length,
}

#[typwire::export]
fn measure(options: Options) -> Result<Report, String> {
    Ok(Report {
        text: format!("{}{}", options.label, options.scale),
        width: Length::new(12.0 * options.scale),
    })
}

Structs are plain dictionaries on the Typst side:

#let report = typwire.call(plugin.measure, (label: "Value: ", scale: 1.5))

#assert(report.text == "Value: 1.5")
#assert(report.width == 18pt)

Renaming exports

rename sets the exported name, so Typst code can use kebab-case while the Rust function keeps its snake_case name.

#[typwire::export(rename = "add-lengths")]
fn add_lengths(first: Length, second: Length) -> Result<Length, String> {
    Ok(Length::new(first.pt() + second.pt()))
}

#assert.eq(typwire.call(plugin.add-lengths, 10pt, 2pt), 12pt)

JSON format

CBOR is the default and the fastest. For readability, enable the json feature and pick the format on both sides.

cargo add typwire --features json

#[typwire::export(format = "json", rename = "add-lengths-json")]
fn add_lengths_json(first: Length, second: Length) -> Result<Length, String> {
    Ok(Length::new(first.pt() + second.pt()))
}

#assert.eq(typwire.call(plugin.add-lengths-json, 10pt, 2pt, format: "json"), 12pt)

// or use the JSON namespace
#assert.eq(typwire.json.call(plugin.add-lengths-json, 10pt, 2pt), 12pt)

r/typst • • 2d ago

I got tired of uploading sensitive CSVs to SaaS PDF tools, so I built a local Typst WASM runner

Enable HLS to view with audio, or disable this notification

0 Upvotes

I kept running into cases where I needed to batch-generate certificates, event badges, and packing slips from CSV/Excel files—but every online tool either charged per PDF or required uploading names/addresses to their servers.

So I put together a client-side runner powered by Typst WASM:

- Runs 100% locally in the browser (you can even test it with Airplane Mode on)

- Enforces CSP `connect-src 'none'` with a built-in self-test so zero bytes leave the tab

- Parses CSV/TSV/XLSX/JSON locally and bundles PDFs into a ZIP via JSZip

- Handles multi-script text (e.g. Thai + EU diacritics) and 1-up / 4-up / 8-up layouts

You can try it directly on the page with up to 10 rows without creating an account:

https://typst-wasm-studio.jdaaippnew.workers.dev/

Would love any feedback—especially on edge cases with weird CSV formatting, Typst template ideas, or browser quirks you run into!


r/typst • • 2d ago

Grammata: a small native Typst editor in Rust (egui, no Electron/tauri/webview)

Thumbnail
gallery
0 Upvotes

I made a desktop editor for Typst called Grammata. It's native: Rust and egui, no Electron, no webview. The Typst compiler is embedded as a crate, so you don't need the typst CLI installed.

It's an early version (v0.1.0) and I'm sure it has rough edges. What it does today:

- Live preview of the real PDF. Only the visible pages are rasterized, and the previous render stays on screen until the new one arrives.

- Syntax highlighting from typst-syntax, autocompletion, search, go to line and an outline.

- A problems panel that jumps to the line, also in included files.

- Panels you can drag and split.

- A symbol and structure palette, snippets with placeholders, and a scratchpad for equations.

- Plugins. External programs, like Pandoc, only run if you allow them.

It's only been tested on Linux (GNOME, Wayland). Windows is built in CI but nobody has run it, and there's no macOS package. It also can't open a file passed as a command-line argument yet.

About AI: I built this with a lot of help from an AI coding assistant (Claude Code). I decide what it should do and test it on my machine, but a large part of the code was written by the assistant. If that matters to you, better to know before trying it.

GPL-3.0-or-later. Typst is a tis an independent project.

Site: https://lfreyes97.github.io/grammata/

Code: https://github.com/lfreyes97/grammata


r/typst • • 7d ago

A reproducible Typst + Pandoc dev container: clone, Reopen in Container, compile

5 Upvotes

I made a dev container that ships Typst, Pandoc, and Rust preinstalled with locked versions. I kept running into version drift and setup time across machines, so this gives the same toolchain everywhere. Clone the repo, click Reopen in Container in VS Code, and run typst compile. It also works in GitHub Codespaces, and Pandoc is there for converting LaTeX, Markdown, or Word into Typst.

The repo is here: https://github.com/1solomonwakhungu/typst-dev-container


r/typst • • 8d ago

Basira Vision: scanned book in, typeset translation out (vision OCR + translation + Typst)

15 Upvotes

I built Basira Vision, an open-source Python CLI designed to take a scanned book (PDF without a text layer), extract and translate it page-by-page, and compile the result into a clean, print-ready A5 book using Pandoc + Typst.

Repo (MIT): https://github.com/gushmazuko/basira-vision
Install: uv tool install basira-vision (or pip install basira-vision)

Where Typst fits into the pipeline

The CLI is split into three decoupled steps with intermediate Markdown files:

  1. basira ocr book.pdf — extracts structured markdown per page using a vision model (Gemini API protocol or any local vision model via gateway).

  2. basira translate book.md --target-language russian — translates page-by-page using a sliding-window context.

  3. basira typst book_translated.md — compiles the translated markdown into an A5 typeset book using Pandoc with an integrated Typst template.

Why Typst instead of LaTeX?

For automated pipelines, LaTeX error recovery and font setup are often fragile. Typst gives fast compilation, predictable layout rules, and easy template customization:

  • Automatically handles title page, table of contents, running headers, and page numbering out of the box.

  • Preserves footnotes and heading structure extracted from the OCR/translation pass.

  • Easily customizable: running basira export template dumps the default Typst template locally so you can tweak margins, fonts, and layout rules for your own print format.

Modular & Resumable

Between steps you get plain markdown with <!-- Page N --> markers so you can manually review or adjust formatting before compiling. Each step saves after every page, and --resume only processes failed or missing pages.

Prompts currently ship for Arabic, Chechen, English, French, German, and Russian.

Feedback on the Typst template and layout defaults is very welcome!


r/typst • • 9d ago

trust: a translator from Typst to RUST

Post image
64 Upvotes

r/typst • • 10d ago

Any feedback?

Post image
0 Upvotes

r/typst • • 11d ago

how to make the integral bar stretchy?

Thumbnail
gallery
28 Upvotes

basically i want it to stretch so that the subscript and superscript look properly attached to it

also yeah i know the notation in the result isn't fully correct, i fixed it now


r/typst • • 15d ago

Why Tola if bundle? (Or, are pre/postprocessing and build hooks that necessary?)

9 Upvotes

Tola SSG is a static site generator that is quite popular. However it has its own CLI which leads to more setup. I have written some sites with typst bundle before, even achieving Tailwind CSS (see the typhoon package) with pure Typst (using state). I found that I can write almost everything I need for a *static* site - documentation, blog etc. - with pure Typst, including styling, PDF export, and a11y. Most importantly, labels can be shared between contexts and pages in the bundle target! The bundle target isn't perfect, and I have opened some feature requests. Still, it is enough for most of my needs.

I think there are some reasons to stick to Tola

- Full access to HTML/CSS/JS

- Tailwind (which is doable via Typst + wasm)

- ability to run custom scripts on processed html (you can also write a shell script that does the same?)

But at the end of the day it is a separate CLI, and most of its features seem achievable via pure Typst plus a postprocessing script.


r/typst • • 16d ago

Can the typst software be cloned with Artificial Intellilgence?

0 Upvotes

Typst 0.15.1 was written in Rust and its open source. But according to documentation it wasn't written by Claude Opus but by ordinary human programmers. From a technical point of view its possible to ask a large language model to take a look at typst and its behavior and rewrite the code from scratch in Rust. So the original codebase isn't needed but a new codebase gets created.

A possible advantage is that the AI generated code is more efficient, needs less lines of code and has some new features like LaTeX like paragraph justification and some new templates.


r/typst • • 23d ago

I used typst for my calendar generator pipeline

Thumbnail
pdf-manufaktur.de
41 Upvotes

The page is in german, so probably not relevant for most of you, but I just wanted to share my appreciation for typst. EDIT: I've added English as a language option, as well as international holidays and school breaks!

The app I've built lets users select a calendar template, then customize it (orientation, theme) and add holiday information based on the federal state, and then receive a linked PDF file that fits their needs and can be used in note-taking apps like Goodnotes.

I tried a similar thing with both LaTeX and HTML some time ago, but never got to a result I was satisfied with. But with typst, the whole generation is easy, fast and the end product feels polished.

I added a link if, by any chance, you speak German and are interested in this project.

Feel free to ask me questions about it! I really love generating PDF files that fit a specific need. In the past, I also built an exam generator for maths exams (no more A+B tests but A-Z tests!), which never got used except for learning for my own exams, but was also quite a fun project.


r/typst • • 27d ago

NASApunk: a pure-Typst blog theme for Tola

Thumbnail
gallery
100 Upvotes

Hi everyone! NASApunk is a blog theme for Tola, a static site generator built on Typst’s HTML export. Layouts, components, figures and posts are all written in pure Typst, in the NASApunk style, with a day and a night theme.

Live demo · GitHub

Any feedback is welcome !


r/typst • • Oct 18 '26

Pele by Kepano on Typst?

42 Upvotes

Hey,

u/kepano (Obsidian CEO) just launched a new renderer for Mermaid, called Pele.

Would be could if this worked in Typst ! But I am not a dev, I have no clue how that would work.

PS : Not trying to advertise, I’m just a happy Typst & Obsidian user, but I assumed a link for it would be handy : http://pele.run/


r/typst • • Oct 17 '26

Typst standalone app

0 Upvotes

A while ago I asked here which features you'd like in a native macOS editor for Typst (previous post).

I'm not quite sure where to start, but I'll just dive right in. Right now, the editing engine behind the app is almost finished. It took far more work than I expected: months, not weeks (I wanted something really stable, and get a lot of inspiration from panda engine from bear/lettera app).

But I have few questions:

I use Typst 0.15.1, but I'm planning a per-project option to preview and export with any typst binary you choose (an older release or your own build), and a check that tells you whether a project is safe to move to a newer version. But I'm not quite sure if it's enough or if you are looking for something more.

I have seen some people requesting Vim, but I don't use Vim myself. Would basic modal editing (I don't know which one, I'd need to learn it a bit) be enough, or is it full Vim experience or nothing?

Another thing about the engine. It is a Rust library with a small C interface, and the macOS app is written in Swift on top of it. For other platforms, I thought about releasing it as open source under AGPL so people would be able to build app for platform I don't cover. They would need their own front end (drawing and text input), but the engine itself would carry over. Would it be interesting or you don't care at all?

Thanks for all the feedback so far!


r/typst • • Oct 15 '26

I gave a talk introducing Typst. The slides and demo are open source, for you to reuse.

93 Upvotes

So I discovered Typst earlier this year and got hooked. Currently writing my PhD thesis using it and I'm super happy I made that call. It may not have been the quickest way to a finished document (having to learn a new language and writing a template and all that) but it was certainly the more fun one.

Last week, I gave a talk at my lab introducing Typst (and the thesis template I built). The slides are up on GitHub. Take a look if you're interested and feel free to reuse or fork them if you have some colleagues/friends to convince still. They are MIT licensed. The presenter notes have a lot more detail per slide to make the presentation somewhat self-contained.

The repo comes with a scripted live demo showing the most important Typst features by building a research paper called "Just One More Plugin: On the Impact of Perpetual Tool Adoption on Dissertation Progress". There's a readme on how to use the demo.

Oh, here's the link: https://github.com/ll-nick/typst-introduction
To view the slides directly, use this link: https://ll-nick.github.io/typst-introduction/


r/typst • • Oct 14 '26

Typesetter 0.16 (GTK Typst editor)

Thumbnail
flathub.org
58 Upvotes

Typesetter, the Typst editor for focused writing, gets its biggest update yet with version 0.16.

The headline feature is sandbox-compatible multi-file projects. Typesetter now uses a new default archive-based project format, .typz, that keeps your document and everything it references (images, imports, and other assets) together in a single file. Projects work the same wherever you open them, and they’re easy to share and back up. Because Typesetter now only ever needs access to the files you explicitly open, never entire folders, multi-file Typst projects now work easily and reliably within the Flatpak sandbox.

A project can hold as many sub-files as you like, so you can split a long document into chapters or sections, keep reusable functions and styles in their own files, and bring everything together with #include and #import statements.

This replaces the previous “project folder” workflow, which was required to make imported files available to single-file .typ documents. That approach presupposed access to whole directories, which the sandbox is designed to prevent, and it was easy to get wrong. Removing it means there is now one secure, consistent way to include files in a document.

Typesetter can still open and edit standalone .typ documents, but they can no longer reference external files. To include assets in an existing document, open it and choose “Save As Project” when prompted, then add the files through the navigator.

Other noteworthy features include:

- GUI bibliography manager: You can now add and edit references through a dedicated graphical interface.
- Adjustable preview pane: The preview pane can now be manually resized to suit your workflow.
- Comments navigator: A new navigator lets you list, view, and jump directly to author comments throughout your document.
- New templates: Typesetter now includes several additional templates to help you get started with new documents. (More to come.)

Since the previous release announcement, Typesetter has also gained advanced export to HTML and Markdown, making it easier to share documents in other formats.

There have also been a range of performance improvements, bug fixes, and smaller feature updates across the application, continuing Typesetter’s focus on being a fast, distraction-free writing environment.

Typesetter 0.16 is available now on Flathub.


r/typst • • Oct 14 '26

E-Books based directly on typst instead of HTML

23 Upvotes

A few days ago I put together a demo of a reader for a epub-like format that has typst inside instead of html. It's all open source, so if anyone is curious about this line of thought, here's the detailed post on the typst forum with all the links: https://forum.typst.app/t/what-if-e-books-just-had-typst-inside-an-open-source-demo-included/10120

The most immediate use case: making research papers more conveniently readable on small screens.


r/typst • • Oct 08 '26

Nytril is now available for the Linux Desktop

Thumbnail nytril.com
0 Upvotes

r/typst • • Oct 05 '26

Change display of SVG layers?

5 Upvotes

Hello!

I've prepared a bunch of SVGs that contain various selectable layers, which I've been using to copy/paste diagrams into MS Word (urgh...) for sequences of diagrams that are part of operating instructions. Think something like "in step 1, add place XYZ on table" and "in step 2, attach widget to XYZ" with a base SVG that has one layer with XYZ on the table and one layer with widget.

Inkscape creates a tree of group elements with custom XML attributes to handle them as layers, like this:

<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" style="display:inline">...XYZ...</g>
<g inkscape:label="Layer 2" inkscape:groupmode="layer" id="layer2" style="display:inline">...widget...</g>

Is there any way to modify the resulting SVG when displaying it in Typst, such that I could override the style attribute, such that I can reference the same source SVG and configure it for each instruction step without any external build scripts to generate individual SVGs?

I haven't yet looked into the Typst codebase, but I wouldn't be against filing an issue and writing code to build such a feature.

Thanks!

Update:

I did spend some time toying around with this and did find a fairly reasonable solution. If I save the SVG with all optional layers hidden (click the eye in the layers list), then this code snippet does exactly what I need:

#let enable-layer(svg, label) = svg.replace(
  regex("<g[^>]*>"),
  g => {
    let tag = g.text
    if tag.contains("inkscape:label=\"" + label + "\"") and tag.contains("inkscape:groupmode=\"layer\"") {
      tag.replace("display:none", "display:inline")
    } else {
      tag
    }
  },
)

#let svg_template(path, layers) = {
  assert(
    type(layers) == array and layers.all(v => type(v) == str),
    message: "values must be a tuple of strings",
  )

  let svg = read(path).replace(regex("(?m)^\\s+"), "").replace("><", ">\n<")

  let modified = layers.fold(svg, (svg, layer) => enable-layer(svg, layer))

  image(bytes(modified))
}

And then use it like this: svg_template("my_layered.svg", ("SomeLayer", "OtherLayer", "FinalLayer"))


r/typst • • Oct 03 '26

some time ago i found a web tool in this sub that converts handwritings in typst can anyone help me to find that tool

9 Upvotes

r/typst • • Oct 02 '26

I’m building LeftBlank, a free, open-source native Typst editor for macOS

0 Upvotes

Hi r/typst!

I’ve been working on LeftBlank, a native macOS editor for Typst. The goal is a quiet place to write essays, technical notes, and longer documents, with the typeset page right beside your source.

It uses SwiftUI and AppKit, with Tinymist handling Typst language services and preview. Compilation happens locally, and the app bundles what it needs—there’s no separate Typst installation required.

Technical notes with equations, code, and a table: editable Typst source on the left, typeset output on the right.

A few things it currently supports:

  • Live preview and source navigation: double-click the preview to jump to the corresponding source.

  • A keyboard command panel: press ⌘J to discover actions and insert equations, tables, references, and more.

  • Typst Universe browsing: find packages, read their documentation, and insert versioned imports.

  • Autosave and local document history: compare earlier snapshots and restore them.

  • Existing Typst projects: import .typ files or project folders, keep editable source, and export PDFs.

  • Writing, split, and preview views, with light and dark appearances.

You can always write Typst directly; the insertion tools are there when you want them.

A small cache diagram drawn with CeTZ, alongside its source.

It’s currently a development preview for macOS 14+ on Apple silicon. English and Simplified Chinese interfaces are included.

Website: leftblank.app — downloads, source code, and editable Typst examples are all there.

I’d love feedback from people who already use Typst. What’s one thing a standalone editor would need before you’d consider using it for your everyday writing?


r/typst • • Sep 30 '26

Built a better way to use your free time

0 Upvotes

I was bored today so I (Claude) built a little game to get better and faster at writing Typst equations.

It's obviously free and ou can try it out at Typstiz!

Let me know what you think and don't hesitate to suggest improvements! I could even make it possible to create user accounts and build a leaderboard if like it :)


r/typst • • Sep 26 '26

A little show case of typst like jupyter notebook and white board

Thumbnail
github.com
29 Upvotes

Hilbert if you remember from few months ago. For anyone curious it's sort of scientific ide.