A Rust implementation of a Markdown to PDF/SVG/PNG document generator with CSS styling support.
- Markdown to PDF / SVG / PNG — Convert Markdown documents into multiple output formats
- CSS Styling — Full CSS selector and property support via built-in stylesheet, external CSS files, or inline
<style>tags in Markdown - GFM Support — GitHub Flavored Markdown including tables, task lists, strikethrough, code blocks with language tags
- Auto Font Detection — Automatically detects document language (Chinese, Japanese, Korean, Latin) and recommends matching fonts
- Page Layout — A4 default, configurable page size/margins via
@pageCSS rules, auto pagination with widow/orphan control - Header & Footer — Configurable page headers (with separator line) and footers with page number templates
{page}/{total} - Hyperlinks — Clickable links in PDF output, works across line breaks
- Tables — Column-width auto-sizing, cross-page splitting, header/alternate row styling
- Images — Auto-scaling, alt text captions, PNG/JPEG/GIF/WebP support
- Code Blocks — Monospace font, gray background, cross-page support
# Convert to PDF (default)
liepress -i document.md -o document.pdf
# Convert to SVG or PNG
liepress -i document.md -o document.svg -f svg
liepress -i document.md -o document.png -f png
# Apply custom CSS stylesheet
liepress -i document.md -o document.pdf -s style.css
# Customize header and footer
liepress -i input.md -o output.pdf --header "Project Report"
liepress -i input.md -o output.pdf --footer "Page {page} / {total}"
# Remove default page number
liepress -i input.md -o output.pdf --no-page-number
# Custom page size and margins
liepress -i input.md -o output.pdf -p A5 --margin 24pt
# Strict CSS parsing (fail on errors)
liepress -i input.md -o output.pdf -Suse liepress::{markdown_to_pdf_with_options, ConvertOptions};
let md = "# Hello\n\nThis is a **Markdown** document.";
let pdf = markdown_to_pdf_with_options(
md,
&ConvertOptions::new()
.with_font_family(&["Noto Sans CJK SC", "sans-serif"])
.with_css("h1 { color: #c00; }")
.with_header("My Document")
.with_footer("- {page} -"),
)?;<style>
body { font-family: "Noto Sans CJK SC", serif; }
h1 { color: #c00; border-bottom: 1px solid #ccc; }
@page {
margin: 36pt 54pt;
header: "Project Report";
footer: "Page {page} / {total}";
}
</style>
# Title
Document content here...cargo install liepressOr build from source:
git clone https://github.com/zzzdong/liepress.git
cd liepress
cargo build --release
./target/release/liepress -i input.md -o output.pdf- Design Document — Architecture, module design, and development guide
liepress --help— CLI usage and all available options
Licensed under either of:
at your option.