convertor is a simple and easy to use library for converting markdown files to various formats.
Project description
📝 md2all
A minimal Python package to convert Markdown files to clean, responsive HTML with Tailwind CSS, MathJax, and beautiful typography.
Ideal for note-taking, documentation, and publishing markdown content as styled web pages.
🚀 Features
- 🧪 Convert
.mdfiles into HTML - 🎨 Built-in support for Tailwind CSS
- 🧮 Renders LaTeX/Math using MathJax
- ✨ Applies prose styling for readability
- 🗂 Outputs to your desired directory
Install Dependencies
🛠️ For Debian/Ubuntu:
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
🛠️ For CentOS/RHEL/Fedora:
sudo dnf install -y \
gstreamer1-plugins-base \
gstreamer1-plugins-good \
gstreamer1-plugins-bad-free \
gstreamer1-libav \
libavif
📦 Installation
pip install md2all
Upcoming Features
- 📜 Support for custom CSS
- Support for PDF generation
- Support for custom themes
- Support for custom fonts
How to Use it
Sure! Here's a concise and developer-friendly documentation for using the convert_markdown function as part of your Python library (assuming it's installed from PyPI):
📄 convert_markdown
Convert a Markdown (.md) file into a styled HTML file with TailwindCSS and MathJax support.
🔧 Function Signature
convert_markdown(md_path: str, output_dir: str = "", output_format: str = "pdf") -> str
✨ Features
- Converts
.mdfiles to clean, styled HTML - Supports LaTeX math using
$$...$$(rendered via MathJax) - Automatically applies Tailwind CSS and custom styling
- Resolves relative paths and saves output to the desired directory
📥 Parameters
| Name | Type | Description |
|---|---|---|
md_path |
str | Path to the input Markdown file. Can be relative or absolute. |
output_dir |
str | (Optional) Directory to save the converted file. Defaults to input file's directory. |
output_format |
str | (Optional) Set to "html" to output HTML. Default is "pdf", but PDF is not implemented yet. |
📤 Returns
- Full path to the converted file.
🧪 Example Usage
from md2all import convert_markdown
# Convert a Markdown file to HTML
output_file = convert_markdown("notes/my_math_notes.md", output_dir="output", output_format="html")
print("File saved to:", output_file)
📁 Output Structure
- create a
.htmlfile to your specifiedoutput_dir, if not provided, it will be saved in the same directory as the input file. - Includes all CSS and MathJax setup in the HTML head section. all css and js library are inside /home/.lib/
Author
- Deepak Raj
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md2all-0.0.4.tar.gz.
File metadata
- Download URL: md2all-0.0.4.tar.gz
- Upload date:
- Size: 570.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f44aa79aa70108b2e50e6f330f50b5773317d139934c08ba899c7d143f81143a
|
|
| MD5 |
7cf78d99ac0018083b21d1bb91b14cdd
|
|
| BLAKE2b-256 |
7738693c15c21c8a5deecf93c88f5a90747f401d6d98ef13168e3ed8800c7199
|
File details
Details for the file md2all-0.0.4-py3-none-any.whl.
File metadata
- Download URL: md2all-0.0.4-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
566c3d3f5a0f6066cd20c0b8660076ce2c028070a0eddbd41fb4a9f5755e1ccf
|
|
| MD5 |
49ea617ea6eefd521cbcee2b164638ad
|
|
| BLAKE2b-256 |
601363219ca99a8230037486c1e6731cec0d621aa0783533e39817b07b82cf39
|