Convert mdBook HTML to PDF with TOC, code highlighting and mermaid diagrams
Project description
mdBook HTML to PDF Converter
将 mdBook 生成的 HTML 文件转换为 PDF,支持:
- 自动生成目录(TOC)
- 代码高亮
- Mermaid 图表转换
安装要求
- Python 3.7+
- Node.js 和 npm(用于 mermaid-cli)
安装步骤
- 安装 Node.js 依赖:
npm install -g @mermaid-js/mermaid-cli
- 安装 Python 包:
pip install mdbookhtml2pdf
使用方法
mdbookhtml2pdf input.html [output.pdf]
如果不指定输出文件名,将使用输入文件名(替换扩展名为.pdf)。
功能特点
-
目录生成
- 自动为 h1-h6 标题生成目录
- 目录包含页码和引导线
- 目录单独成页
-
代码高亮
- 支持多种编程语言
- 保持原有的代码格式
- 支持行内代码和代码块
-
Mermaid 图表
- 自动转换 mermaid 图表为高质量图片
- 支持所有 mermaid 图表类型
- 保持图表清晰度
项目地址
todo
目前封面支持存在部分问题,后续有空时,会解决改问题,其他的开发者可以自行尝试解决.
许可证
MIT License
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
mdbookhtml2pdf-0.2.0.tar.gz
(15.3 kB
view details)
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 mdbookhtml2pdf-0.2.0.tar.gz.
File metadata
- Download URL: mdbookhtml2pdf-0.2.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcb6d9a4548256d7eea87f936b34f7deda475fa74f923d8d7bcb4c3d12cbdd20
|
|
| MD5 |
b0e9cc9a77883a139ee971314fc03969
|
|
| BLAKE2b-256 |
c84208e10e8d9430c3299b97011dd840251ec8296218b81a2a64903263cc3c54
|
File details
Details for the file mdbookhtml2pdf-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mdbookhtml2pdf-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7f747f60fc110468ed0f110b82b9e41aa9c921d803a0f7bdfe2aa7f4a2bd470
|
|
| MD5 |
a6284decee720d022498159484998b53
|
|
| BLAKE2b-256 |
06d6df326b8ef33e56773ee95e186b6888b9ccfabfddd97abae948479c4a8c99
|