Name | markdown-html-pdf JSON |
Version |
0.3.1
JSON |
| download |
home_page | None |
Summary | A powerful Python package to convert Markdown files to PDF with syntax highlighting and emoji support |
upload_time | 2025-07-14 15:03:00 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2025 Gustavo Casadei Bellanda Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
converter
markdown
pdf
playwright
syntax-highlighting
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# markdown-html-pdf
A powerful Python package to convert Markdown files to PDF with syntax highlighting and emoji support.
## Features
- ✨ Convert Markdown to PDF with beautiful formatting
- 🎨 Syntax highlighting for code blocks
- 😀 Full emoji support
- 🔧 GitHub-flavored Markdown support
- 📱 Responsive design optimized for print
- 🚀 Fast conversion using Playwright
- 💻 Command-line interface
- 🐍 Python API
## Installation
```bash
uv add markdown-html-pdf
```
After installation, you need to install Playwright browsers:
```bash
sudo $(which uv) run playwright install
```
### Linux Emoji Font Setup
For proper emoji rendering in PDFs on Linux systems, you need to install the Segoe UI Emoji font. This is required for emojis to display correctly in the generated PDFs.
```bash
sudo $(which uv) run install-emoji-fonts
```
**Note:** This step is only required on Linux systems and needs to be run once per system.
## Usage
### Command Line
```bash
# Basic conversion
uv run markdown-html-pdf input.md output.pdf
```
You can also use the shorter alias:
```bash
uv run md2pdf input.md output.pdf
```
### Available Commands
- `markdown-html-pdf` or `md2pdf`: Convert Markdown to PDF
- `install-emoji-fonts`: Install emoji fonts for Linux systems (requires sudo)
### Python API
```python
import asyncio
from markdown_html_pdf.tools import markdown_to_pdf
async def convert():
await markdown_to_pdf(
markdown_file_path="input.md",
pdf_output_file_path="output.pdf"
)
asyncio.run(convert())
```
## Requirements
- Python 3.9+
- Playwright (automatically installed)
## How it works
1. **Markdown to HTML**: Converts Markdown to HTML using `markdown-it-py` with GitHub-flavored Markdown support
2. **Syntax Highlighting**: Applies syntax highlighting to code blocks using Pygments
3. **HTML to PDF**: Uses Playwright to render HTML to PDF with optimized settings for text fidelity
## Supported Markdown Features
- Headers (H1-H6)
- **Bold** and _italic_ text
- `Inline code` and code blocks with syntax highlighting
- Links and images
- Tables
- Lists (ordered and unordered)
- Blockquotes
- Horizontal rules
- Emojis 😎
## Troubleshooting
### Emoji Rendering Issues on Linux
If emojis are not displaying correctly in your PDFs on Linux systems:
1. **Install emoji fonts**:
- `sudo $(which uv) run install-emoji-fonts` (uses full path)
2. **Verify installation**: Check if fonts are installed with `fc-list | grep -i emoji`
3. **Restart applications**: Restart your terminal and any running applications
4. **Check permissions**: Ensure the font files have proper permissions (644)
### Browser Installation Issues
If you encounter issues with Playwright browsers:
1. **Manual installation**: Run `uv run playwright install`
2. **System dependencies**: Install system dependencies with `uv run playwright install-deps`
3. **Permissions**: Ensure you have proper permissions to install browsers
## License
MIT License - see LICENSE file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Raw data
{
"_id": null,
"home_page": null,
"name": "markdown-html-pdf",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "converter, markdown, pdf, playwright, syntax-highlighting",
"author": null,
"author_email": "Gustavo Casadei Bellanda <bellanda.dev@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/82/dc/357cfd9a32e16b99eecbdeffb2670d1e303dd4aa55f7273ecfe9e0e3026e/markdown_html_pdf-0.3.1.tar.gz",
"platform": null,
"description": "# markdown-html-pdf\n\nA powerful Python package to convert Markdown files to PDF with syntax highlighting and emoji support.\n\n## Features\n\n- \u2728 Convert Markdown to PDF with beautiful formatting\n- \ud83c\udfa8 Syntax highlighting for code blocks\n- \ud83d\ude00 Full emoji support\n- \ud83d\udd27 GitHub-flavored Markdown support\n- \ud83d\udcf1 Responsive design optimized for print\n- \ud83d\ude80 Fast conversion using Playwright\n- \ud83d\udcbb Command-line interface\n- \ud83d\udc0d Python API\n\n## Installation\n\n```bash\nuv add markdown-html-pdf\n```\n\nAfter installation, you need to install Playwright browsers:\n\n```bash\nsudo $(which uv) run playwright install\n```\n\n### Linux Emoji Font Setup\n\nFor proper emoji rendering in PDFs on Linux systems, you need to install the Segoe UI Emoji font. This is required for emojis to display correctly in the generated PDFs.\n\n```bash\nsudo $(which uv) run install-emoji-fonts\n```\n\n**Note:** This step is only required on Linux systems and needs to be run once per system.\n\n## Usage\n\n### Command Line\n\n```bash\n# Basic conversion\nuv run markdown-html-pdf input.md output.pdf\n```\n\nYou can also use the shorter alias:\n\n```bash\nuv run md2pdf input.md output.pdf\n```\n\n### Available Commands\n\n- `markdown-html-pdf` or `md2pdf`: Convert Markdown to PDF\n- `install-emoji-fonts`: Install emoji fonts for Linux systems (requires sudo)\n\n### Python API\n\n```python\nimport asyncio\nfrom markdown_html_pdf.tools import markdown_to_pdf\n\nasync def convert():\n await markdown_to_pdf(\n markdown_file_path=\"input.md\",\n pdf_output_file_path=\"output.pdf\"\n )\n\nasyncio.run(convert())\n```\n\n## Requirements\n\n- Python 3.9+\n- Playwright (automatically installed)\n\n## How it works\n\n1. **Markdown to HTML**: Converts Markdown to HTML using `markdown-it-py` with GitHub-flavored Markdown support\n2. **Syntax Highlighting**: Applies syntax highlighting to code blocks using Pygments\n3. **HTML to PDF**: Uses Playwright to render HTML to PDF with optimized settings for text fidelity\n\n## Supported Markdown Features\n\n- Headers (H1-H6)\n- **Bold** and _italic_ text\n- `Inline code` and code blocks with syntax highlighting\n- Links and images\n- Tables\n- Lists (ordered and unordered)\n- Blockquotes\n- Horizontal rules\n- Emojis \ud83d\ude0e\n\n## Troubleshooting\n\n### Emoji Rendering Issues on Linux\n\nIf emojis are not displaying correctly in your PDFs on Linux systems:\n\n1. **Install emoji fonts**:\n\n - `sudo $(which uv) run install-emoji-fonts` (uses full path)\n\n2. **Verify installation**: Check if fonts are installed with `fc-list | grep -i emoji`\n3. **Restart applications**: Restart your terminal and any running applications\n4. **Check permissions**: Ensure the font files have proper permissions (644)\n\n### Browser Installation Issues\n\nIf you encounter issues with Playwright browsers:\n\n1. **Manual installation**: Run `uv run playwright install`\n2. **System dependencies**: Install system dependencies with `uv run playwright install-deps`\n3. **Permissions**: Ensure you have proper permissions to install browsers\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2025 Gustavo Casadei Bellanda Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "A powerful Python package to convert Markdown files to PDF with syntax highlighting and emoji support",
"version": "0.3.1",
"project_urls": {
"Homepage": "https://github.com/bellanda/markdown-html-pdf",
"Issues": "https://github.com/bellanda/markdown-html-pdf/issues",
"Repository": "https://github.com/bellanda/markdown-html-pdf"
},
"split_keywords": [
"converter",
" markdown",
" pdf",
" playwright",
" syntax-highlighting"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "97d6935b7a49a5e56dfa597c0f2c09327485585bf3790580b131fd0ac2aa3f51",
"md5": "5688492729212773f7bed61fb8417ecf",
"sha256": "0e558657adb8df2dbddd888170b295708a8018813771fc565384b460092d98dc"
},
"downloads": -1,
"filename": "markdown_html_pdf-0.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5688492729212773f7bed61fb8417ecf",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 14380006,
"upload_time": "2025-07-14T15:02:55",
"upload_time_iso_8601": "2025-07-14T15:02:55.758695Z",
"url": "https://files.pythonhosted.org/packages/97/d6/935b7a49a5e56dfa597c0f2c09327485585bf3790580b131fd0ac2aa3f51/markdown_html_pdf-0.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "82dc357cfd9a32e16b99eecbdeffb2670d1e303dd4aa55f7273ecfe9e0e3026e",
"md5": "bfcb38c17318282eb2fa47a46931f42f",
"sha256": "3766983465fccfeee69e1d346d462203867f26c002457c2e96c8aa2cec0756b8"
},
"downloads": -1,
"filename": "markdown_html_pdf-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "bfcb38c17318282eb2fa47a46931f42f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 14384710,
"upload_time": "2025-07-14T15:03:00",
"upload_time_iso_8601": "2025-07-14T15:03:00.952481Z",
"url": "https://files.pythonhosted.org/packages/82/dc/357cfd9a32e16b99eecbdeffb2670d1e303dd4aa55f7273ecfe9e0e3026e/markdown_html_pdf-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 15:03:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bellanda",
"github_project": "markdown-html-pdf",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "markdown-html-pdf"
}