mdpdf reads Markdown, parses it into an mdast syntax tree with the markdown crate, and renders that tree to PDF with genpdf.
cargo run -- document.md
cargo run -- document.md --output document.pdf
cat document.md | cargo run -- - --output document.pdf
When no output path is provided, file input uses the same name with a .pdf extension. Stdin input uses output.pdf.
All the common things are supported
This is a paragraph with strong text, emphasized text, both even, deleted text, and inline code.
Links preserve their readable text: the Rust website.
This line has a hard break.
The next sentence follows it.
- An unordered item
- An item with nested content
- A nested unordered item
- Another nested item
- The final unordered item
- An ordered item
- Another ordered item
A block quote has a frame around it.
It can contain multiple paragraphs.
fn main() {
println!("Hello from a monospaced code block");
}Images are resolved relative to this Markdown file:
| Feature | Status | Notes |
|---|---|---|
| Headings | Supported | Six levels |
| Code | Supported | Monospaced |
| Tables | Supported | GFM syntax |
| italics | bold | inline |
Remote images, raw HTML, MDX, and mathematical notation are not rendered yet. Local image paths must exist when the Markdown file is converted.
