Skip to content

nervosys/md2typ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md2typ: Markdown to Typst Translator

Markdown → Typst (→ PDF) converter and CLI utility.

Features

  • Markdown → Typst translation with CommonMark + GFM support:
    • Headings, emphasis, strong, strikethrough
    • Lists: unordered, ordered, nested, and task lists
    • Tables with per-column alignment
    • Blockquotes, horizontal rules
    • Footnotes
  • Code blocks: passed through unchanged as fenced Markdown
  • Smart CLI:
    • --output out.typ → emits Typst source
    • --output out.pdf → compiles directly to PDF (auto-installs Typst if missing)

Installation

From source

# Clone and build
git clone https://github.com/your-org/md2typ.git
cd md2typ
cargo build --release

# Install into your PATH
cargo install --path .

From crates.io

cargo install md2typ

Requires Rust 1.70+ and Cargo. If Typst is not already installed, the CLI will run cargo install typst on first PDF use.

Usage

# Translate Markdown to Typst (stdout)
md2typ README.md

# Save Typst output
md2typ README.md --output out.typ

# Produce PDF directly
md2typ README.md --output out.pdf

Options

USAGE:
    md2typst [OPTIONS] [INPUT]

ARGS:
    <INPUT>    Input Markdown file (default: stdin)

OPTIONS:
    -o, --output <PATH>   Output file: .typ (Typst source) or .pdf (compiled)
        --preamble        Add a simple Typst preamble at top
    -h, --help            Print help
    -V, --version         Print version

Examples

Convert a Markdown design doc to Typst:

md2typ docs/design.md --output docs/design.typ

Convert a report directly to PDF:

md2typ report.md --output report.pdf

Pipe Markdown from stdin:

cat notes.md | md2typ --output notes.pdf

Development

Run unit tests:

cargo test

Format code:

cargo fmt

Lint:

cargo clippy --all-targets --all-features -- -D warnings

Roadmap

  • Improve Typst table rendering
  • Add more configurable preamble options
  • Allow themes/templates for PDF output
  • CI/CD builds & release binaries

Contributing

Pull requests are welcome! Please open an issue to discuss changes or feature requests.

License

Apache 2.0 © 2025 Nervosys, LLC

About

Markdown-to-Typst File Translator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages