Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
/ typst-pandoc Public archive

Typst custom reader and writer for Pandoc

License

Notifications You must be signed in to change notification settings

lvignoli/typst-pandoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 custom reader and writer for Pandoc

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.

Usage

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.

TODO

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

Features completeness

Checked items are minimally supported.
Unchecked items are not supported.

Writer

Blocks

  • Plain
  • Para
  • LineBlock
  • CodeBlock
  • RawBlock
  • BlockQuote
  • OrderedList
  • BulletList
  • DefinitionList
  • Header
  • HorizontalRule
  • Table
  • Figure
  • Div

Inlines

  • 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

Reader

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].

Blocks

  • Plain
  • Para
  • LineBlock
  • CodeBlock
  • RawBlock
  • BlockQuote (no markup)
  • OrderedList
  • BulletList
  • DefinitionList
  • Header
  • HorizontalRule
  • Table
  • Figure
  • Div (probably corresponds to a content block)

Inlines

  • 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

About

Typst custom reader and writer for Pandoc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages