mdtool
一个强大的 Markdown 转换工具库。
版本: v0.1.0
背景
在日常开发中,我们经常需要将 Markdown 文档转换为其他格式(如 HTML、PDF、DOCX 等),但现有的解决方案存在诸多痛点:
- 配置繁琐:许多库需要复杂的配置和依赖管理,学习成本高
- 中文支持差:部分工具对中文显示支持不佳,需要额外配置字体和编码
- 样式定制困难:自定义样式需要深入了解工具的内部机制
- 收费限制:一些在线工具和商业软件需要付费,功能受限
- 依赖繁重:某些库依赖过多,安装和使用都不够轻量
为了解决这些问题,我开发了 mdtool —— 一个简单、高效、免费的 Markdown 转换工具库。
简介
mdtool 是一个 Python 库,旨在提供简单易用的 Markdown 转换功能。该库支持将 Markdown 文档转换为多种格式,方便用户在不同场景下使用。
当前版本支持:
- Markdown → HTML
计划支持:
- Markdown → PDF
- Markdown → DOCX
- 更多格式...
项目地址
- Gitee: https://gitee.com/zheng-enci050704/mdtool
- GitHub: https://github.com/Zheng-Enci/mdtool
- GitCode: https://gitcode.com/ZhengEnCi/mdtool
功能特性
- 📝 简单易用:提供简洁的 API 接口
- 🚀 高性能:基于高效的转换引擎
- 🔧 可扩展:支持自定义转换器和插件
- 📦 轻量级:最小化依赖,易于集成
- 🎨 样式灵活:支持自定义 CSS 样式
- 🌐 中文友好:内置中文字体支持,UTF-8 编码
安装
从源码安装
# 选择一个源进行克隆
git clone https://github.com/Zheng-Enci/mdtool.git
# 或
git clone https://gitee.com/zheng-enci050704/mdtool.git
# 或
git clone https://gitcode.com/ZhengEnCi/mdtool.git
# 安装依赖
cd mdtool
pip install -r requirements.txt
使用安装脚本(推荐国内用户)
项目提供了一个安装脚本,使用清华源加速依赖下载:
cd mdtool
python installl_requirements.py
该脚本会自动从清华源安装 requirements.txt 中的所有依赖项,速度更快。
依赖项
- Python 3.13+
快速开始
查看 examples/ 目录获取完整示例。
开发计划
- 实现 Markdown 到 HTML 的转换
- 支持自定义 CSS 样式
- 支持中文显示
- 自动创建输出目录
- 添加更多代码高亮主题
- 支持自定义主题模板
- 添加命令行工具
- 完善单元测试
- 发布到 PyPI
项目结构
mdtool/
├── mdtool/ # 主包目录
│ ├── __init__.py # 包初始化文件 (v0.1.0)
│ ├── html_converter.py # HTML转换器核心模块
│ ├── parsers/ # 解析器模块
│ │ ├── __init__.py
│ │ └── markdown_parser.py # Markdown解析器
│ └── exporters/ # 导出器模块
│ ├── __init__.py
│ └── html_exporter.py # HTML导出器
├── examples/ # 示例代码
│ └── html_example/
│ ├── html_example.py # HTML转换示例
│ ├── sample.md # 示例Markdown文件
│ ├── custom.css # 自定义CSS样式
│ └── examples/
│ └── sample.html # 生成的HTML文件
├── Note/ # 笔记目录
│ └── Update_logs/ # 更新日志
├── README.md # 项目说明文档
├── requirements.txt # 依赖列表
├── installl_requirements.py # 安装脚本
└── main.py # 主程序入口
贡献指南
欢迎贡献代码!请遵循以下步骤:
- Fork 本项目
- 创建特性分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 开启 Pull Request
许可证
MIT License
致谢
感谢所有为本项目做出贡献的开发者!
注意:本项目正在积极开发中,API 可能会有变化。建议关注版本更新日志。
Metadata
Release files for zec-mdtool 0.1.0
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 |
|---|---|---|---|---|
| zec_mdtool-0.1.0.tar.gz | 10.6 kB | Without provenance | Details for zec_mdtool-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zec_mdtool-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for zec_mdtool-0.1.0-py3-none-any.whl |
Total release size: 20.0 kB
Release files / zec_mdtool-0.1.0.tar.gz
| Download URL | zec_mdtool-0.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7555cf54d75cace09e7f9e2be0abbeaeaf19d19e15820697c157cae16c54ff1c
|
|
BLAKE2b-256 checksum How to use checksums |
b3d0f35c90db9aa6fbb51f5c64b4a5c5427ab29755d4612eb586fa9edba07228
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / zec_mdtool-0.1.0-py3-none-any.whl
| Download URL | zec_mdtool-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3313c415f106b0170616deba3cde8c29f9f5a73a131b40b63ea57d0d95ab3b9
|
|
BLAKE2b-256 checksum How to use checksums |
c0266aa2ecae1ad911e0558761ebae5ee8f999aaa7b04cf11f0dd9d6f4e69269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for zec-mdtool 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.