A diff tool for Typst documents, similar to latexdiff for LaTeX
See the codeA diff tool for Typst documents, similar to latexdiff for LaTeX.
typdiff compares two Typst source files and generates a new Typst document that visually highlights the differences — added text in blue with underline and deleted text in red with strikethrough.
Given an old document:
= Introduction
This is the old text.
- First item
- Second item
== Details
The quick brown fox jumps over the lazy dog.
And a new document:
= Background
This is the new text.
- First item
- Third item
- Fourth item
== Details
The quick red fox leaps over the lazy cat.
Running typdiff old.typ new.typ produces:
= #diff-deleted[Introduction]
= #diff-added[Background]
This is the #diff-deleted[old]#diff-added[new] text.
- First item
- #diff-deleted[Second]#diff-added[Third] item
- #diff-added[Fourth item]
== Details
The quick #diff-deleted[brown]#diff-added[red] fox #diff-deleted[jumps]#diff-added[leaps] over the lazy #diff-deleted[dog]#diff-added[cat].
Compile the output with typst compile to get a PDF with visual diff markup.
mise 2026.9.2 or later installs the appropriate prebuilt binary for your platform from the release's signed packslip manifest, verifying the signature and the archive's digest before unpacking it.
mise use -g packslip:github.com/sou1118/typdiff
Releases before v0.1.4 have no packslip manifest. To install one of them, or with an older mise, use the GitHub backend, which verifies GitHub Artifact Attestations when available:
mise use -g github:sou1118/typdiff
cargo install typdiff
cargo install --git https://github.com/sou1118/typdiff
typdiff <OLD> <NEW> [-o <OUTPUT>]
| Argument | Description |
|---|---|
<OLD> | Path to the old Typst file |
<NEW> | Path to the new Typst file |
-o, --output <OUTPUT> | Output file path (defaults to stdout) |
# Print diff to stdout
typdiff old.typ new.typ
# Save diff to a file
typdiff old.typ new.typ -o diff.typ
# Generate a PDF
typdiff old.typ new.typ -o diff.typ && typst compile diff.typ
typst-syntax#diff-added[...] and #diff-deleted[...] markupApache-2.0
3,496 followers · starred Aug 2026
338 followers · starred Jun 2026
615 followers · starred Jun 2026
176 followers · starred Feb 2026
A diff tool for Typst documents, similar to latexdiff for LaTeX
See the codeA diff tool for Typst documents, similar to latexdiff for LaTeX.
typdiff compares two Typst source files and generates a new Typst document that visually highlights the differences — added text in blue with underline and deleted text in red with strikethrough.
Given an old document:
= Introduction
This is the old text.
- First item
- Second item
== Details
The quick brown fox jumps over the lazy dog.
And a new document:
= Background
This is the new text.
- First item
- Third item
- Fourth item
== Details
The quick red fox leaps over the lazy cat.
Running typdiff old.typ new.typ produces:
= #diff-deleted[Introduction]
= #diff-added[Background]
This is the #diff-deleted[old]#diff-added[new] text.
- First item
- #diff-deleted[Second]#diff-added[Third] item
- #diff-added[Fourth item]
== Details
The quick #diff-deleted[brown]#diff-added[red] fox #diff-deleted[jumps]#diff-added[leaps] over the lazy #diff-deleted[dog]#diff-added[cat].
Compile the output with typst compile to get a PDF with visual diff markup.
mise 2026.9.2 or later installs the appropriate prebuilt binary for your platform from the release's signed packslip manifest, verifying the signature and the archive's digest before unpacking it.
mise use -g packslip:github.com/sou1118/typdiff
Releases before v0.1.4 have no packslip manifest. To install one of them, or with an older mise, use the GitHub backend, which verifies GitHub Artifact Attestations when available:
mise use -g github:sou1118/typdiff
cargo install typdiff
cargo install --git https://github.com/sou1118/typdiff
typdiff <OLD> <NEW> [-o <OUTPUT>]
| Argument | Description |
|---|---|
<OLD> | Path to the old Typst file |
<NEW> | Path to the new Typst file |
-o, --output <OUTPUT> | Output file path (defaults to stdout) |
# Print diff to stdout
typdiff old.typ new.typ
# Save diff to a file
typdiff old.typ new.typ -o diff.typ
# Generate a PDF
typdiff old.typ new.typ -o diff.typ && typst compile diff.typ
typst-syntax#diff-added[...] and #diff-deleted[...] markupApache-2.0
3,496 followers · starred Aug 2026
338 followers · starred Jun 2026
615 followers · starred Jun 2026
176 followers · starred Feb 2026