-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
There are two possible routes to converting typst documents using pandoc:
-
Modify typst itself so that it can produce some output format that pandoc can already parse. HTML has been discussed, and there's also Implement pandoc output (and thus indirectly Markdown, HTML, ePub, docx output) typst/typst#461 which produces a pandoc AST. (Even if that were merged, it doesn't translate equations into the latex format expected by pandoc.)
-
Add a reader to pandoc. This is a fairly complex project, because typst implements a complete programming language, which pandoc would have to interpret. On the other hand, writing interpreters in Haskell is fairly pleasant and I don't see any difficulties in principle. Steps:
a. Add a typst reader to jgm/texmath (for math conversion) jgm/texmath#211
b. Create a self-standing Haskell library to parse and interpret typst, producing a typst-specific AST
c. Create a pandoc reader that uses this library and then converts the typst AST to a pandoc AST
Of course any reader would be lossy, in the sense that detailed layout information (spacing, placing, font size, etc.) would be lost, but that's okay.