A lightweight, extensible Markdown → HTML converter with a clean Python API and CLI.
Built for simplicity, hackability, and future extension.
-> https://mdparser.tarunnayaka.me
- Lightweight alternative to full Markdown engines
- Easy to extend and hack
- Designed for learning, tooling, and static generators
- Markdown → HTML conversion
- Full HTML document or body-only output
- Syntax highlighting via CDN (Prism / Highlight.js)
- Headings, lists, code blocks, images
- Fenced blocks (
:::) - CLI + Python API
- Zero runtime dependencies
- Tailwind support
pip install mdparser-htmlmd2html input.md -o output.htmlBasic usage
from mdparser import parse_markdown
html = parse_markdown("# Hello World")
print(html)mdparser-html supports attaching custom CSS or Tailwind utility classes
directly from Markdown using fenced blocks and headings.
Tailwind is included automatically when include_cdn=True is set.
Example:
::: bg-blue-100 p-4 rounded-lg
# Welcome
This section is styled using Tailwind classes.
:::<div class="bg-blue-100 p-4 rounded-lg">
<h1>Welcome</h1>
<p>This section is styled using Tailwind classes.</p>
</div>## [text-green-500 font-bold] Success HeadingRenders as:
<h2 class="text-green-500 font-bold">Success Heading</h2>markdown_text, full_html=True, title="My Document", include_cdn=True # Include syntax highlighting CDN links ) print(html)
body = parse_markdown(markdown_text, full_html=False)
print(body):::
# Welcome
This is a hero section
:::<div class="hero">
<h1>Welcome</h1>
<p>This is a hero section</p>
</div>- Headings (
#→########) - Bold / Italic
- Inline code
- Fenced code blocks
- Ordered & unordered lists
- Images
- Fenced div blocks
- Links
- Blockquotes
- Horizontal rules
- Paragraphs
- Tables (basic)
- Single public API:
parse_markdown - Internal helpers are intentionally hidden
- Designed for future renderers (HTML today, more later)
Create a new file called CHANGELOG.md
- AST-based parser
- Performance optimizations
- Additional output formats (e.g. Pug)
- Plugin hooks
Pull requests are welcome. Please open an issue before major changes.
MIT License © 2025 Tarun Nayaka R (Rtarun3606k)
