{"id":19930639,"url":"https://github.com/theiskaa/markdown2pdf","last_synced_at":"2026-05-26T10:00:57.989Z","repository":{"id":197840550,"uuid":"699466672","full_name":"theiskaa/markdown2pdf","owner":"theiskaa","description":"Markdown to pdf transpiler written in pure Rust","archived":false,"fork":false,"pushed_at":"2026-05-21T12:13:09.000Z","size":3594,"stargazers_count":218,"open_issues_count":2,"forks_count":16,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-05-21T16:27:04.482Z","etag":null,"topics":["markdown","markdown-to-pdf","markdown2pdf","md","pdf","pdf-generator"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/markdown2pdf","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theiskaa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":"https://github.com/theiskaa/markdown2pdf/blob/main/DONATE.md"}},"created_at":"2023-10-02T17:33:10.000Z","updated_at":"2026-05-21T08:44:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"810dbeba-d5ee-4ae8-8cea-824d5fa77f5d","html_url":"https://github.com/theiskaa/markdown2pdf","commit_stats":null,"previous_names":["theiskaa/mdpdf","theiskaa/mdp","theiskaa/markdown2pdf"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/theiskaa/markdown2pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theiskaa%2Fmarkdown2pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theiskaa%2Fmarkdown2pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theiskaa%2Fmarkdown2pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theiskaa%2Fmarkdown2pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theiskaa","download_url":"https://codeload.github.com/theiskaa/markdown2pdf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theiskaa%2Fmarkdown2pdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33514912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T03:12:49.672Z","status":"ssl_error","status_checked_at":"2026-05-26T03:12:47.976Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["markdown","markdown-to-pdf","markdown2pdf","md","pdf","pdf-generator"],"created_at":"2024-11-12T23:04:41.235Z","updated_at":"2026-05-26T10:00:57.983Z","avatar_url":"https://github.com/theiskaa.png","language":"Rust","funding_links":["https://github.com/theiskaa/markdown2pdf/blob/main/DONATE.md"],"categories":["Rust"],"sub_categories":[],"readme":"\u003cimg width=\"600px\" src=\"https://github.com/user-attachments/assets/fe2e96b8-a0bd-43b4-9360-e6cce43693f2\"\u003e\n\n\u003cp align=\"center\"\u003e\n\n[![CI](https://github.com/theiskaa/markdown2pdf/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/theiskaa/markdown2pdf/actions/workflows/ci.yml)\n[![Documentation](https://img.shields.io/docsrs/markdown2pdf)](https://docs.rs/markdown2pdf)\n[![Crates.io](https://img.shields.io/crates/v/markdown2pdf?color=orange)](https://crates.io/crates/markdown2pdf)\n[![Release](https://img.shields.io/github/v/release/theiskaa/markdown2pdf)](https://github.com/theiskaa/markdown2pdf/releases)\n[![MSRV](https://img.shields.io/crates/msrv/markdown2pdf?color=orange)](Cargo.toml)\n[![License](https://img.shields.io/crates/l/markdown2pdf?color=blue)](LICENSE)\n[![Downloads](https://img.shields.io/crates/d/markdown2pdf)](https://crates.io/crates/markdown2pdf)\n\n\u003c/p\u003e\n\nmarkdown2pdf converts Markdown to PDF through a fully in-tree pipeline: a CommonMark/GFM lexer, a TOML-driven style resolver, and a layout engine built directly on `printpdf`. There is no intermediate HTML and no third-party document engine.\n\nIt ships as both a binary and a library. The binary converts from a file, URL, or string on the command line; the library exposes programmatic generation with full control over styling and fonts. Configuration is loaded at runtime or embedded at compile time for containerized deployments.\n\nThe lexer targets CommonMark 0.31.2 plus GFM and note-tool extensions such as WikiLinks, `==highlight==`, and LaTeX math, and passes 649 of the 652 CommonMark spec examples. The exceptions are deliberate, where the WikiLink syntax reclaims `[[…]]` (which CommonMark treats as nested brackets). Conformance is held in place by the full CommonMark spec runner alongside the lexer-unit, stress, and adversarial renderer suites.\n\nThe renderer covers headings with bookmarks and anchors, the full inline-emphasis set (bold, italic, monospace, strikethrough, underline, highlight, super/subscript, small-caps), nested ordered/unordered/task lists, GFM tables with per-column alignment, header repeat, and merged cells (a `\u003e` cell extends the one before it across columns, a `^` cell continues the one above down a row; escape a literal marker with `\\\u003e` / `\\^`), blockquotes, admonition / callout boxes in both MkDocs (`!!! note \"Optional title\"`) and GitHub (`\u003e [!WARNING]`) styles with per-kind vector icons, fenced and indented code, images (local, URL, SVG), footnotes, definition lists, cross-references, and inline HTML (anchors become clickable links; `\u003cdiv\u003e` / `\u003csection\u003e` / `\u003cfigure\u003e` wrappers drop through to their children). Mathematics is typeset by a built-in TeX engine — real fraction bars, radicals, script stacks, big operators with limits, growing delimiters, matrices, and accents — drawn as vector outlines and configurable through a `[math]` style block.\n\nDocuments are styled per block with six bundled themes, configurable page setup, running headers and footers, an auto-generated table of contents, a title page, YAML/TOML frontmatter, and PDF metadata. Output is written to a file or returned as an in-memory byte buffer.\n\n## Install binary\n\n### Homebrew\n\n```sh\nbrew install theiskaa/tap/markdown2pdf\n```\n\n### Cargo\n\nInstall the binary globally using cargo:\n\n```bash\ncargo install markdown2pdf\n```\n\nFor the latest git version:\n\n```bash\ncargo install --git https://github.com/theiskaa/markdown2pdf\n```\n\nURL input (`-u`) and SVG images are behind optional features; pass\nthem to `cargo install` (see [Feature flags](#feature-flags)):\n\n```bash\ncargo install markdown2pdf --features fetch,svg\n```\n\n### Prebuilt binaries\n\nPrebuilt versions are available in our [GitHub releases](https://github.com/theiskaa/markdown2pdf/releases/latest):\n\n|  File  | Platform | Checksum |\n|--------|----------|----------|\n| [markdown2pdf-aarch64-apple-darwin.tar.xz](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-aarch64-apple-darwin.tar.xz.sha256) |\n| [markdown2pdf-x86_64-apple-darwin.tar.xz](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-x86_64-apple-darwin.tar.xz.sha256) |\n| [markdown2pdf-x86_64-pc-windows-msvc.zip](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-x86_64-pc-windows-msvc.zip.sha256) |\n| [markdown2pdf-aarch64-unknown-linux-gnu.tar.xz](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-aarch64-unknown-linux-gnu.tar.xz) | ARM64 Linux | [checksum](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-aarch64-unknown-linux-gnu.tar.xz.sha256) |\n| [markdown2pdf-x86_64-unknown-linux-gnu.tar.xz](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-x86_64-unknown-linux-gnu.tar.xz) | x64 Linux | [checksum](https://github.com/theiskaa/markdown2pdf/releases/latest/download/markdown2pdf-x86_64-unknown-linux-gnu.tar.xz.sha256) |\n\n## Install as library\n\nAdd the crate to your project:\n\n```bash\ncargo add markdown2pdf\n```\n\nOr, in `Cargo.toml`:\n\n```toml\n# Minimal — local files only, no network, no SVG\nmarkdown2pdf = \"1.5.0\"\n\n# Or with URL fetching + SVG rasterization\nmarkdown2pdf = { version = \"1.5.0\", features = [\"fetch\", \"svg\"] }\n```\n\nSee [docs/library.md](docs/library.md) for the programmatic API.\n\n## Feature flags\n\nTwo optional features, both off by default and shared by the binary\nand the library. The library enables them in `Cargo.toml`\n(`features = [...]`); the binary enables them at install or build\ntime (`cargo install markdown2pdf --features fetch,svg`).\n\n- **`fetch`** — URL input (the `-u`/`--url` flag) and remote images.\n  Uses pure-Rust TLS (rustls), so no system OpenSSL is needed; works\n  in `rust:slim` and Alpine. If you need native TLS for corporate\n  certificate stores, depend on `reqwest` directly with your\n  preferred backend and Cargo will unify the features.\n- **`svg`** — SVG image rasterization via `resvg`, for SVG embedded\n  through `![](path.svg)` or `\u003cimg src=\"...svg\"\u003e`.\n\n## Configuration\n\nEvery visual choice — fonts, colors, page setup, headers / footers,\ntable of contents, title page, alignment, per-block typography — lives\nin a TOML configuration. Six bundled themes (`default`, `github`,\n`academic`, `minimal`, `compact`, `modern`) give one-line styling;\nper-block overrides handle the long tail; and **any value can be\noverridden per-run from the command line**, winning over the config\nfile and theme.\n\n```sh\n# A theme\nmarkdown2pdf -p input.md --theme github -o out.pdf\n\n# Your own config file\nmarkdown2pdf -p input.md -c my-config.toml -o out.pdf\n\n# Override individual values at runtime (highest priority)\nmarkdown2pdf -p input.md --title \"Report\" --font-size 11 --margin 2.5cm \\\n  --page-numbers -V headings.h1.font_size_pt=28 -o out.pdf\n```\n\nThe full schema with every field explained is in\n**[`docs/configuration.md`](docs/configuration.md)**; an annotated,\ncopy-and-tweak reference config is **[`docs/config.toml`](docs/config.toml)**.\n\n## Usage\n\nThe binary converts a file (`-p`), a string (`-s`), or a URL (`-u`,\nwith the `fetch` feature) to a PDF (`-o`, default `./output.pdf`).\n\n```bash\nmarkdown2pdf -p docs/resume.md -o resume.pdf\nmarkdown2pdf -s \"**bold** *italic*.\" -o out.pdf\nmarkdown2pdf -p doc.md --theme academic --page-numbers -o out.pdf\n```\n\n`--dry-run` validates input without writing; `--print-effective-config`\nemits the resolved style as TOML; `--verbose` and `--quiet` adjust\nlogging. The complete flag reference, config-override precedence, and\nfont selection are in **[`docs/cli.md`](docs/cli.md)**.\n\n## Library Usage\n\n`parse_into_file` writes a PDF to disk; `parse_into_bytes` returns the\ndocument as a `Vec\u003cu8\u003e` for in-memory use. `ConfigSource` selects\nstyling — `Default`, `Theme(\"github\")`, `File(path)`, or\n`Embedded(toml)`.\n\n```rust\nuse markdown2pdf::{parse_into_file, config::ConfigSource};\n\nparse_into_file(\"# Hello\".into(), \"out.pdf\", ConfigSource::Default, None)?;\nparse_into_file(\"# Doc\".into(), \"out.pdf\", ConfigSource::Theme(\"academic\"), None)?;\n```\n\nPre-resolved styles and runtime overrides, font selection (by name,\npath, or embedded bytes), frontmatter, and the error model are\ncovered in **[`docs/library.md`](docs/library.md)**.\n\n## Contributing\nFor information regarding contributions, please refer to [CONTRIBUTING.md](CONTRIBUTING.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheiskaa%2Fmarkdown2pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheiskaa%2Fmarkdown2pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheiskaa%2Fmarkdown2pdf/lists"}