md2html-tailwind4
A Python package that converts Markdown to clean, styled HTML using Tailwind CSS 4 utilities and semantic theme tokens.
Designed for projects that render HTML inside a Tailwind-powered frontend (Django, FastAPI, static sites, etc.).
Features
- Converts Markdown to HTML with Tailwind CSS 4 classes and DaisyUI-compatible semantic tokens (
base-*,primary,secondary-*) - Configurable font size scale (
sm,base,lg) - Abbreviations (
abbr) with dotted underline tooltip - Definition lists (
dl/dt/dd) - Footnotes (
[^1]syntax) - Admonition callout boxes (
!!! note,!!! warning,!!! danger, etc.) with color-coded Tailwind styling - Inline/block math parsing via
pymdownx.arithmatex(e.g.$\\rightarrow$) with automatic MathJax loader injection - Heading anchor IDs auto-generated via
tocextension - List items immediately following a paragraph (no blank line) render correctly
- Responsive tables with overflow scrolling
- Audio table support (3-column tables with media URLs become interactive audio players)
- Automatically escapes Django template delimiters (
{{ }},{% %}) inside code blocks - External links get
target="_blank"andrel="noopener noreferrer"automatically - Dark mode support via Tailwind's
dark:variants - CLI tool included
Installation
pip install md2html-tailwind4
To style semantic tokens correctly, compile the provided stylesheet in your app:
npm install
npm run tailwind:build
Usage
Python API
from md2html_tailwind4 import Converter
# font_size: 'sm' | 'base' (default) | 'lg'
converter = Converter(font_size='sm')
html = converter.convert_md_to_html("# Hello\n\nThis is **Markdown**.")
print(html)
Command Line
md2html input.md output.html
# Use a smaller font size
md2html input.md output.html --font-size sm
Font Size Scales
| Scale | Heading 1 | Body text | Code block |
|---|---|---|---|
sm |
text-xl → text-3xl |
text-sm |
text-xs |
base (default) |
text-2xl → text-4xl |
text-base |
text-sm |
lg |
text-3xl → text-5xl |
text-lg |
text-base |
HTML Output & Integration
The generated HTML is production-ready with:
- Tailwind CSS 4 + DaisyUI token-based classes already applied
- MathJax 3 automatically injected when math expressions detected
- Dark mode support via
dark:variants - Responsive design for all elements
- Security hardening (Django template escaping, external link attributes)
See HTML_HANDLING.md for detailed integration guides with Django, FastAPI, and more.
Math Support
Format math expressions with $...$ or \(...\):
Pricing: $4.99 \rightarrow $14.99
Physics: $E=mc^2$
Formula: \[\sum_{i=1}^{n} x_i\]
Smart normalization handles split expressions:
$4.99 \rightarrow $14.99→$4.99 \rightarrow 14.99$✓- MathJax loaded automatically when needed
Requirements
- Python >= 3.11
License
MIT — White Neuron Co., Ltd.
Metadata
Release files for md2html-tailwind4 1.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| md2html_tailwind4-1.5.3.tar.gz | 20.9 kB | With provenance | Details for md2html_tailwind4-1.5.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| md2html_tailwind4-1.5.3-py3-none-any.whl | Python 3 | none | any | Details for md2html_tailwind4-1.5.3-py3-none-any.whl |
Total release size: 33.3 kB
Release files / md2html_tailwind4-1.5.3.tar.gz
| Download URL | md2html_tailwind4-1.5.3.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba2fada7df17afb38e9fdc6a17a504f5d99a2b474b9095d509fb9fa54436e47a
|
|
BLAKE2b-256 checksum How to use checksums |
2963637f3c6d6ffff9fc170c91d1213f8149688315d6d358a67b125834750d50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / md2html_tailwind4-1.5.3-py3-none-any.whl
| Download URL | md2html_tailwind4-1.5.3-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b5b51fd75c503cac994110ab35bb8a07f4498a616df87ab4597ec3d761586ad
|
|
BLAKE2b-256 checksum How to use checksums |
37cf6dbba71a24008730e6eb1143e384c7fe304fb3d7822a80f766dc95fd8be3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logSecurity for md2html-tailwind4 1.5.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for md2html_tailwind4-1.5.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.