{"id":19930639,"url":"https://github.com/theiskaa/markdown2pdf","last_synced_at":"2026-01-27T17:11:24.702Z","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":"2025-11-19T14:49:03.000Z","size":1876,"stargazers_count":186,"open_issues_count":7,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-19T16:21:38.451Z","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":"2025-11-19T14:58:38.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":11,"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":28816595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"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-01-27T17:11:24.697Z","avatar_url":"https://github.com/theiskaa.png","language":"Rust","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[![Crates.io](https://img.shields.io/crates/v/markdown2pdf)](https://crates.io/crates/markdown2pdf)\n[![Documentation](https://img.shields.io/docsrs/markdown2pdf)](https://docs.rs/markdown2pdf)\n[![License](https://img.shields.io/crates/l/markdown2pdf)](LICENSE)\n[![Downloads](https://img.shields.io/crates/d/markdown2pdf)](https://crates.io/crates/markdown2pdf)\n[![GitHub Stars](https://img.shields.io/github/stars/theiskaa/markdown2pdf)](https://github.com/theiskaa/markdown2pdf/stargazers)\n\n\u003c/p\u003e\n\nmarkdown2pdf converts Markdown to PDF using a lexical analyzer and PDF rendering engine. The library tokenizes Markdown into semantic elements, applies styling rules from TOML configuration, and generates styled PDF output.\n\nBoth binary and library are provided. The binary offers CLI conversion from files, URLs, or strings. The library enables programmatic PDF generation with full control over styling and fonts. Configuration can be loaded at runtime or embedded at compile time for containerized deployments.\n\nBuilt in Rust for performance and memory safety. Handles standard Markdown syntax including headings, lists, code blocks, links, tables, and images. Supports multiple input sources and outputs to files or bytes for in-memory processing.\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\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 to your project:\n\n```bash\ncargo add markdown2pdf\n```\n\nOr add to your Cargo.toml:\n\n```toml\nmarkdown2pdf = \"0.2.1\"\n```\n\n### Feature Flags\n\nThe library provides optional feature flags to control dependencies:\n\n- **Default (no features)**: Core PDF generation from files and strings. No network dependencies.\n- **`fetch`**: Enables URL fetching support (requires one of the TLS features below).\n- **`native-tls`**: Enables URL fetching with native TLS/OpenSSL (recommended for most users).\n- **`rustls-tls`**: Enables URL fetching with pure-Rust TLS implementation (useful for static linking or avoiding OpenSSL).\n\n```toml\n# Minimal installation (no network dependencies)\nmarkdown2pdf = \"0.2.1\"\n\n# With URL fetching support (native TLS)\nmarkdown2pdf = { version = \"0.2.1\", features = [\"native-tls\"] }\n\n# With URL fetching support (rustls)\nmarkdown2pdf = { version = \"0.2.1\", features = [\"rustls-tls\"] }\n```\n\n**Note**: Binary installations via cargo or prebuilt downloads do not include URL fetching by default. To build the binary with URL support:\n\n```bash\n# Install with URL fetching support\ncargo install markdown2pdf --features native-tls\n\n# Or build from source\ncargo build --release --features native-tls\n```\n\n## Usage\n\nThe tool accepts file paths (`-p`), string content (`-s`), or URLs (`-u`) as input. Output path is specified with `-o`. Input precedence: path \u003e url \u003e string. Defaults to 'output.pdf'.\n\nConvert a Markdown file:\n```bash\nmarkdown2pdf -p \"docs/resume.md\" -o \"resume.pdf\"\n```\n\nConvert string content:\n```bash\nmarkdown2pdf -s \"**bold text** *italic text*.\" -o \"output.pdf\"\n```\n\nConvert from URL (requires `native-tls` or `rustls-tls` feature):\n```bash\nmarkdown2pdf -u \"https://raw.githubusercontent.com/user/repo/main/README.md\" -o \"readme.pdf\"\n```\n\nUse `--verbose` for detailed output, `--quiet` for CI/CD pipelines, or `--dry-run` to validate syntax without generating PDF.\n\n## Fonts\n\nThe font system supports three modes:\n\n- **Built-in fonts**: Helvetica, Times, Courier (fastest, no file I/O)\n- **System fonts**: Searches standard OS font directories\n- **File paths**: Load directly from a TTF/OTF file\n\n```bash\n# Use built-in font (fastest)\nmarkdown2pdf -p document.md -o output.pdf\n\n# Use system font\nmarkdown2pdf -p document.md --default-font Georgia -o output.pdf\n\n# Use specific font file\nmarkdown2pdf -p document.md --default-font \"/path/to/font.ttf\" -o output.pdf\n```\n\nFont subsetting is enabled by default, reducing PDF size by embedding only the glyphs used in the document. A Unicode document with Arial Unicode MS produces ~45KB instead of 23MB.\n\nPerformance is ~20ms for standard documents with built-in fonts.\n\n## Library Usage\n\nTwo main functions: `parse_into_file()` saves PDF to disk, `parse_into_bytes()` returns bytes for web services. Both parse Markdown, apply styling, and render output.\n\nConfiguration uses `ConfigSource`: `Default` for built-in styling, `File(\"path\")` for runtime loading, or `Embedded(content)` for compile-time embedding.\n\n```rust\nuse markdown2pdf::{parse_into_file, config::ConfigSource};\n\n// Default styling\nparse_into_file(markdown, \"output.pdf\", ConfigSource::Default, None)?;\n\n// File-based configuration\nparse_into_file(markdown, \"output.pdf\", ConfigSource::File(\"config.toml\"), None)?;\n\n// Embedded configuration\nconst CONFIG: \u0026str = include_str!(\"../config.toml\");\nparse_into_file(markdown, \"output.pdf\", ConfigSource::Embedded(CONFIG), None)?;\n```\n\nFont configuration uses `FontConfig` for programmatic control:\n\n```rust\nuse markdown2pdf::{parse_into_file, config::ConfigSource, fonts::FontConfig};\n\nlet font_config = FontConfig::new()\n    .with_default_font(\"Georgia\")\n    .with_code_font(\"Courier\");\n\nparse_into_file(\n    markdown,\n    \"output.pdf\",\n    ConfigSource::Default,\n    Some(\u0026font_config),\n)?;\n```\n\n## Logging\n\nThe library uses the [`log`](https://crates.io/crates/log) crate. No output by default. Enable with any `log`-compatible backend (e.g., `env_logger`) and set `RUST_LOG=markdown2pdf=info` or `debug` for diagnostics.\n\n## Configuration\n\nTOML configuration customizes fonts, colors, spacing, and visual properties. Three loading methods: default styles, runtime files, or compile-time embedding.\n\nFor binary usage, create a config file at `~/markdown2pdfrc.toml` and copy the example configuration from `markdown2pdfrc.example.toml`. For library usage with embedded config, create your configuration file and embed it using `include_str!()`.\n\n## Contributing\nFor information regarding contributions, please refer to [CONTRIBUTING.md](CONTRIBUTING.md) file.\n","funding_links":["https://github.com/theiskaa/markdown2pdf/blob/main/DONATE.md"],"categories":["Rust"],"sub_categories":[],"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"}