Sure! Here's a professionally rewritten and polished version of your md2all
documentation, designed to feel like official open-source documentation:
A lightweight Python package to convert Markdown files into beautiful, responsive HTML or PDF documents—styled with Tailwind CSS, MathJax, and optimized for clean typography.
Ideal for note-taking, documentation, and publishing Markdown content without relying on external CDN access.
- ✅ Convert
.md
files into clean HTML or PDF - 🎨 Styled using Tailwind CSS
- 🧮 Built-in MathJax support for LaTeX equations
- 📝 Beautiful, readable typography with prose class
- 📦 Works offline — no internet or CDN required
- 🔄 Support for CLI
To generate PDFs via Playwright, some system libraries must be installed.
sudo apt update
sudo apt install -y \
libavif13 \
libgstreamer-plugins-base1.0-0 \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-libav \
libgstreamer-gl1.0-0 \
libgstreamer-plugins-bad1.0-0 \
libgstreamer-plugins-base1.0-dev
sudo dnf install -y \
gstreamer1-plugins-base \
gstreamer1-plugins-good \
gstreamer1-plugins-bad-free \
gstreamer1-libav \
libavif
Install md2all
using pip
:
pip install md2all
See
test_data/
for example Markdown and the output.
Convert a Markdown file to HTML or PDF with optional offline/online resource support.
Parameter | Type | Description |
---|---|---|
md_path |
str |
Path to the Markdown file (relative or absolute). |
output_dir |
str |
(Optional) Directory to save the output. Defaults to the input file's directory. |
output_format |
str |
(Optional) "html" or "pdf" format. Default is "pdf" . |
use_cdn |
bool |
(Optional) If True , loads Tailwind and MathJax via CDN. Default is False . |
str
: Full path to the converted file.
from md2all import convert_markdown
# Convert to HTML
convert_markdown("test_data/test.md", output_format="html")
# Convert to PDF
convert_markdown("test_data/test.md", output_format="pdf")
import asyncio
from md2all import convert_markdown
async def convert_all():
await convert_markdown("test_data/test.md", output_format="html")
await convert_markdown("test_data/test.md", output_format="pdf")
asyncio.run(convert_all())
After installation, the CLI command md2all
is available globally.
md2all -m <md_path> -f <format> [options]
Flag | Description |
---|---|
-m , --md_path |
Path to the input Markdown file. (Required) |
-f , --format |
Output format: "html" or "pdf" . (Required) |
-o , --output_dir |
(Optional) Output directory. Defaults to the input file’s folder. |
-c , --use_cdn |
(Optional) Use CDN for Tailwind and MathJax. Defaults to offline. |
md2all -m notes/readme.md -f html
md2all -m notes/readme.md -f pdf -o ./exports
md2all -m notes/readme.md -f pdf -c
- Outputs
.html
or.pdf
file to your chosen directory. - Automatically includes all required styling and MathJax configuration.
- Offline assets (CSS/JS) are stored under
~/.lib/
.
Deepak Raj
GitHub – codeperfectplus
I built
md2all
to make Markdown publishing easier—especially on systems without internet access. With a built-in offline mode, it's ideal for generating clean documents on secure or offline environments.
This is an open-source project. Found a bug or want a feature?
Feel free to open an issue or pull request.