pandoc 3.1.2 now provides a Typst writer to convert to Typst. A reader is also planned.
Hence, because of upcoming native support for Typst, this extension will not be maintained.
Typst is a modern markup-based typesetting system with powerful typesetting and scripting capabilities. It's really great.
Pandoc is a universal document converter that handles lots of formats.
The custom reader.lua
and writer.lua
allow converting to and from Typst using Pandoc embedded Lua engine.
pandoc -t writer.lua input.tex -o output.typ
pandoc -f reader.lua input.typ -o output.html
Hint: Try converting this README to Typst!
See Pandoc User's guide for more advanced usage.
Some planned improvements to be done.
- Better formatting
- Sort imports
- Support tight and sparse lists properly
- Improve standalone template with prettier default
- Parse the language of code blocks in Typst markup [reader]
- Parse Typst nested lists (that's a bit tricky here, use a recursive pattern or an LPeg dedicated grammar) [reader]
- Parse escaped Typst markup characters [reader]
- Work towards feature completeness
- Handle most informative attributes in the writer
- …
Checked items are minimally supported.
Unchecked items are not supported.
- Plain
- Para
- LineBlock
- CodeBlock
- RawBlock
- BlockQuote
- OrderedList
- BulletList
- DefinitionList
- Header
- HorizontalRule
- Table
- Figure
- Div
- Str
- Emph
- Underline
- Strong
- Strikeout
- Superscript
- Subscript
- SmallCaps
- Quoted
- Cite
- Code
- Space
- SoftBreak
- LineBreak
- Math (needs to convert TeX syntax to Typst)
- RawInline
- Link
- Image
- Note
- Span
Some Pandoc AST items do not have a dedicated Typst markup.
The result is usually obtained by a generic and expected function call, which could be parsed, such as #strike[redacted]
or #underline[important]
.
- Plain
- Para
- LineBlock
- CodeBlock
- RawBlock
- BlockQuote (no markup)
- OrderedList
- BulletList
- DefinitionList
- Header
- HorizontalRule
- Table
- Figure
- Div (probably corresponds to a content block)
- Str
- Emph
- Underline (no markup)
- Strong
- Strikeout (no markup)
- Superscript
- Subscript
- SmallCaps
- Quoted
- Cite
- Code
- Space
- SoftBreak
- LineBreak
- Math (needs to convert TeX syntax to Typst, not planned)
- RawInline
- Link
- Image
- Note
- Span