- Prepare a
diff.typ
source file as shown in this Gist. - Provided you have two Typst SOURCE files named
a.typ
andb.typ
, execute:pandiff --from typst --to typst a.typ b.typ > diff.content.typ
- Compile the
diff.typ
file:typst compile diff.typ
Created
February 13, 2025 11:47
-
-
Save Dragonink/2c50e4b9ed8ba071060f15b1977aa05c to your computer and use it in GitHub Desktop.
How to Typst + PanDiff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#let INS_RE = regex(`\{\+{2}(.+)\+{2}\}`.text) | |
#show INS_RE: this => { | |
let (contents,) = this.text.match(INS_RE).captures | |
box(outset: 0.25em, fill: green.transparentize(85%), underline(text(fill: green, contents))) | |
} | |
#let DEL_RE = regex(`\{(?:-{2}|–)(.+)(?:-{2}|–)}`.text) | |
#show DEL_RE: this => { | |
let (contents,) = this.text.match(DEL_RE).captures | |
box(outset: 0.25em, fill: red.transparentize(85%), strike(text(fill: red, contents))) | |
} | |
#include "diff.content.typ" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment