{"id":13825391,"url":"https://github.com/jmaupetit/md2pdf","last_synced_at":"2026-01-18T09:53:40.731Z","repository":{"id":9274415,"uuid":"11104658","full_name":"jmaupetit/md2pdf","owner":"jmaupetit","description":"Markdown to PDF with styles","archived":false,"fork":false,"pushed_at":"2026-01-12T18:02:37.000Z","size":442,"stargazers_count":394,"open_issues_count":15,"forks_count":51,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-01-12T18:34:24.400Z","etag":null,"topics":["css","markdown","pdf","pdf-generation"],"latest_commit_sha":null,"homepage":"","language":"Python","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/jmaupetit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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}},"created_at":"2013-07-01T19:26:04.000Z","updated_at":"2026-01-12T15:20:02.000Z","dependencies_parsed_at":"2024-04-09T14:47:03.482Z","dependency_job_id":"f3f3c649-5ae4-4912-9da2-557cb207f545","html_url":"https://github.com/jmaupetit/md2pdf","commit_stats":{"total_commits":113,"total_committers":11,"mean_commits":"10.272727272727273","dds":0.5663716814159292,"last_synced_commit":"526b9755db0100f86d45d61a2783d2379b962b0d"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/jmaupetit/md2pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaupetit%2Fmd2pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaupetit%2Fmd2pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaupetit%2Fmd2pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaupetit%2Fmd2pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmaupetit","download_url":"https://codeload.github.com/jmaupetit/md2pdf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmaupetit%2Fmd2pdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["css","markdown","pdf","pdf-generation"],"created_at":"2024-08-04T09:01:20.033Z","updated_at":"2026-01-18T09:53:40.690Z","avatar_url":"https://github.com/jmaupetit.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"![md2pdf logo](https://github.com/jmaupetit/md2pdf/raw/main/assets/md2pdf-logo.png)\n\nConvert Markdown files to PDF with styles.\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/jmaupetit/md2pdf/quality.yml)\n![PyPI - Version](https://img.shields.io/pypi/v/md2pdf)\n\n\n## Installation\n\nThe easiest way to test `md2pdf` is to use `uv`:\n\n```bash\n$ uv tool install md2pdf\n```\n\n_Nota bene:_ ensure, Weasyprint is fully functional before using md2pdf. You\nwill find installation instructions in the project documentation:\n[https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation)\n\n## Usage\n\n### As a CLI\n\n```\nUsage: md2pdf [OPTIONS] MD PDF\n\n  md2pdf command line tool.\n\nOptions:\n  --css PATH\n  -e, --extras TEXT\n  --version          Show the version and exit.\n  --help             Show this message and exit.\n```\n\nFor example, try to generate the project documentation with:\n\n```bash\n$ md2pdf README.md README.pdf\n```\n\nOptionally, you may load an external style:\n\n```bash\n$ md2pdf \\\n    --css examples/custom-styles.css \\\n    README.md \\\n    README.pdf\n```\n\nAnd activate [markdown extensions from\nPyMdown](https://facelessuser.github.io/pymdown-extensions/):\n\n```bash\n$ md2pdf \\\n    --css examples/custom-styles-with-pygments.css \\\n    --extras 'pymdownx.emoji' \\\n    README.md \\\n    README.pdf\n```\n\n\u003e Code blocks should be properly rendered when this extension is active.\n\n### As a library\n\nIf you have added `md2pdf` as a dependency for your python project, you can use\n`md2pdf` in your code, like:\n\n```python\nfrom md2pdf.core import md2pdf\n\nmd2pdf(pdf,\n       md=None,\n       raw=None,\n       css=None,\n       base_url=None,\n       extras=[],\n       context={\"foo\": 1}\n)\n```\n\nFunction arguments:\n\n* `pdf`: output PDF file path\n* `raw`: input markdown raw string content (can contain Jinja instructions)\n* `md`: input markdown file path (can contain Jinja instructions)\n* `css`: input styles path (CSS)\n* `base_url`: absolute base path for markdown linked content (as images)\n* `extras`: [markdown extra\n   extensions](https://python-markdown.github.io/extensions/) that should be\n   activated\n* `context`: variables to inject to rendered Jinja template\n\n### With Docker\n\nInstall [Docker](https://www.docker.com/)\n\nPull the image:\n\n```bash\n$ docker pull jmaupetit/md2pdf\n```\n\nNow run your image:\n\n```bash\n$ docker run --rm \\\n    -v $PWD:/app \\\n    -u \"$(id -u):$(id -g)\" \\\n    jmaupetit/md2pdf --css styles.css INPUT.MD OUTPUT.PDF\n```\n\n### Use Jinja templates as input\n\nYour input markdown file or raw content can include\n[Jinja](https://jinja.palletsprojects.com/en/stable/) template tags, and\ncontext can be given in a frontmatter header:\n\n```md\n---\ngroceries:\n  - name: apple\n    quantity: 4 \n  - name: orange \n    quantity: 10\n  - name: banana \n    quantity: 6\n---\n\n# Groceries\n\n| Item | Quantity |\n| ---- | -------- |\n{% for item in groceries -%}\n| {{ item.name }} | {{ item.quantity }} |\n{% endfor %}\n\n```\n\nOr directly as a `md2pdf` argument (see library usage).\n\nYou can test this example using:\n\n```bash\n$ md2pdf \\\n    --css examples/gutenberg-modern.min.css \\\n    examples/my-music.md.j2 \\\n    examples/my-music.pdf\n```\n\n## Contributing\n\n### Hacking\n\nClone this project first:\n\n```bash\n$ git clone git@github.com:jmaupetit/md2pdf.git\n```\n\nInstall md2pdf along with its dependencies (using\n[uv](https://docs.astral.sh/uv/)):\n\n```bash\n$ cd md2pdf\n$ make bootstrap\n```\n\n### Running the test suite\n\nTo run the test suite:\n\n```bash\n$ make test\n```\n\nLint the code via:\n\n```bash\n$ make lint\n```\n\n### Ease your life\n\nIf you are familiar with GNU Make, we also automate daily tasks using this\nlovely tool:\n\n```bash\n$ make help\n```\n\n## License\n\n`md2pdf` is released under the MIT License. See the bundled LICENSE file for\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmaupetit%2Fmd2pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmaupetit%2Fmd2pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmaupetit%2Fmd2pdf/lists"}