agent-markdown-pdf 0.2.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/PKG-INFO +168 -85
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/README.md +160 -79
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/agent_markdown_pdf.egg-info/PKG-INFO +168 -85
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/agent_markdown_pdf.egg-info/SOURCES.txt +17 -1
- agent_markdown_pdf-0.3.0/agent_markdown_pdf.egg-info/requires.txt +17 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/api.py +15 -19
- agent_markdown_pdf-0.3.0/mdtopdf/core/browser.py +246 -0
- agent_markdown_pdf-0.3.0/mdtopdf/core/diagnostics.py +39 -0
- agent_markdown_pdf-0.3.0/mdtopdf/core/doctor.py +144 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/core/fonts.py +214 -36
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/core/html.py +10 -2
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/core/inline.py +34 -0
- agent_markdown_pdf-0.3.0/mdtopdf/core/katex.py +32 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/core/markdown.py +36 -237
- agent_markdown_pdf-0.3.0/mdtopdf/core/mermaid.py +36 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/core/obsidian.py +8 -5
- agent_markdown_pdf-0.3.0/mdtopdf/core/output.py +29 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/core/pdf.py +15 -20
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/mdtopdf_cli.py +122 -15
- agent_markdown_pdf-0.3.0/mdtopdf/skills/SKILL.md +70 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/themes/default.css +38 -37
- agent_markdown_pdf-0.3.0/mdtopdf/vendor/browser-render.js +29 -0
- agent_markdown_pdf-0.3.0/mdtopdf/vendor/mermaid/LICENSE +21 -0
- agent_markdown_pdf-0.3.0/mdtopdf/vendor/mermaid/NOTICE.md +8 -0
- agent_markdown_pdf-0.3.0/mdtopdf/vendor/mermaid/mermaid.min.js +3405 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/pyproject.toml +12 -6
- agent_markdown_pdf-0.3.0/tests/test_browser.py +108 -0
- agent_markdown_pdf-0.3.0/tests/test_browser_discovery.py +125 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/tests/test_core.py +81 -261
- agent_markdown_pdf-0.3.0/tests/test_decorations.py +115 -0
- agent_markdown_pdf-0.3.0/tests/test_dependency_diagnostics.py +47 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/tests/test_full_e2e.py +20 -15
- agent_markdown_pdf-0.3.0/tests/test_macos_fonts.py +17 -0
- agent_markdown_pdf-0.3.0/tests/test_math_alignment.py +36 -0
- agent_markdown_pdf-0.3.0/tests/test_pdfium.py +57 -0
- agent_markdown_pdf-0.3.0/tests/test_reliability.py +280 -0
- agent_markdown_pdf-0.3.0/tests/test_stdin.py +123 -0
- agent_markdown_pdf-0.2.2/agent_markdown_pdf.egg-info/requires.txt +0 -13
- agent_markdown_pdf-0.2.2/mdtopdf/core/doctor.py +0 -366
- agent_markdown_pdf-0.2.2/mdtopdf/core/katex.py +0 -75
- agent_markdown_pdf-0.2.2/mdtopdf/core/mermaid.py +0 -181
- agent_markdown_pdf-0.2.2/mdtopdf/skills/SKILL.md +0 -107
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/LICENSE +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/agent_markdown_pdf.egg-info/dependency_links.txt +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/agent_markdown_pdf.egg-info/entry_points.txt +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/agent_markdown_pdf.egg-info/top_level.txt +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/__init__.py +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/__main__.py +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/core/__init__.py +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/LICENSE +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/contrib/mhchem.min.js +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/katex.min.css +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/mdtopdf/vendor/katex/dist/katex.min.js +0 -0
- {agent_markdown_pdf-0.2.2 → agent_markdown_pdf-0.3.0}/setup.cfg +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-markdown-pdf
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Agent-friendly Markdown-to-PDF CLI with HTML preview and JSON diagnostics
|
|
5
5
|
Author: rainp
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/ABClize/mdtopdf
|
|
8
8
|
Project-URL: Repository, https://github.com/ABClize/mdtopdf
|
|
9
9
|
Project-URL: Issues, https://github.com/ABClize/mdtopdf/issues
|
|
10
|
-
Keywords: markdown,pdf,markdown-to-pdf,
|
|
10
|
+
Keywords: markdown,pdf,markdown-to-pdf,chromium,obsidian,cli,agent,automation,json
|
|
11
11
|
Classifier: Development Status :: 3 - Alpha
|
|
12
12
|
Classifier: Environment :: Console
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
@@ -29,20 +29,23 @@ Requires-Dist: click>=8.0.0
|
|
|
29
29
|
Requires-Dist: markdown-it-py>=3.0.0
|
|
30
30
|
Requires-Dist: mdit-py-plugins>=0.4.0
|
|
31
31
|
Requires-Dist: pygments>=2.0.0
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist: weasyprint>=69.0
|
|
32
|
+
Requires-Dist: playwright<2,>=1.51
|
|
33
|
+
Requires-Dist: tinycss2>=1.4.0
|
|
34
|
+
Requires-Dist: fonttools[woff]>=4.59.2
|
|
36
35
|
Provides-Extra: dev
|
|
37
36
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
38
37
|
Requires-Dist: build>=1.2.0; extra == "dev"
|
|
39
38
|
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pypdfium2>=4.30.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pillow>=10.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "dev"
|
|
40
42
|
Dynamic: license-file
|
|
41
43
|
|
|
42
44
|
<h1 align="center">mdtopdf: Agent-friendly Markdown-to-PDF CLI</h1>
|
|
43
45
|
|
|
44
46
|
<p align="center">
|
|
45
|
-
<a href="https://github.com/ABClize/mdtopdf/blob/main/README_CN.md">中文文档</a>
|
|
47
|
+
<a href="https://github.com/ABClize/mdtopdf/blob/main/README_CN.md">中文文档</a> |
|
|
48
|
+
<a href="https://github.com/ABClize/mdtopdf/blob/main/README.es-ES.md">Español</a>
|
|
46
49
|
</p>
|
|
47
50
|
|
|
48
51
|
<p align="center">
|
|
@@ -56,7 +59,7 @@ Dynamic: license-file
|
|
|
56
59
|
<p align="center">
|
|
57
60
|
<img src="https://img.shields.io/pypi/pyversions/agent_markdown_pdf.svg" alt="Python versions">
|
|
58
61
|
<img src="https://img.shields.io/badge/output-JSON_%2B_Human-blueviolet" alt="JSON and human output">
|
|
59
|
-
<img src="https://img.shields.io/badge/backend-
|
|
62
|
+
<img src="https://img.shields.io/badge/backend-Chromium-2f855a" alt="Chromium backend">
|
|
60
63
|
<img src="https://img.shields.io/badge/status-alpha-f59e0b" alt="Alpha status">
|
|
61
64
|
</p>
|
|
62
65
|
|
|
@@ -76,15 +79,15 @@ command-line interface where the style can be defined up front.
|
|
|
76
79
|
|
|
77
80
|
- **Agent-friendly** - `mdtopdf --help` is an interface description an agent can read.
|
|
78
81
|
- **JSON when it matters** - conversion, HTML preview, environment checks, and theme listing can return machine-readable output.
|
|
79
|
-
- **Local files in, local files out** -
|
|
82
|
+
- **Local files in, local files out** - an isolated headless browser, no upload step, no remote rendering service.
|
|
80
83
|
- **More than plain Markdown** - Obsidian links, highlights, frontmatter, comments, and callouts are rendered.
|
|
81
84
|
|
|
82
85
|
## Quick start
|
|
83
86
|
|
|
84
|
-
Install from PyPI:
|
|
87
|
+
Install from PyPI in your Python environment:
|
|
85
88
|
|
|
86
89
|
```shell
|
|
87
|
-
python -m pip install agent-markdown-pdf
|
|
90
|
+
python -m pip install "agent-markdown-pdf>=0.3.0"
|
|
88
91
|
```
|
|
89
92
|
|
|
90
93
|
The PyPI distribution is `agent-markdown-pdf`; it installs the `mdtopdf` command.
|
|
@@ -97,12 +100,17 @@ intentionally different from the command name.
|
|
|
97
100
|
| Run the CLI | `mdtopdf` |
|
|
98
101
|
| Import in Python | `mdtopdf` |
|
|
99
102
|
|
|
100
|
-
Check the machine:
|
|
103
|
+
Check the machine before the first conversion:
|
|
101
104
|
|
|
102
105
|
```shell
|
|
103
|
-
mdtopdf doctor --json
|
|
106
|
+
mdtopdf doctor --render-check --json
|
|
104
107
|
```
|
|
105
108
|
|
|
109
|
+
The package installs the Python dependencies, including Playwright. You also need
|
|
110
|
+
a compatible Chromium browser and the fonts your documents use. An installed
|
|
111
|
+
Chrome, Edge, or Chromium is discovered automatically; if none is found, follow
|
|
112
|
+
[Browser setup](#browser-setup). This check actually renders PDF, math, and diagrams.
|
|
113
|
+
|
|
106
114
|
Convert a file:
|
|
107
115
|
|
|
108
116
|
```shell
|
|
@@ -114,7 +122,8 @@ Try the bundled visual test document:
|
|
|
114
122
|
```shell
|
|
115
123
|
git clone https://github.com/ABClize/mdtopdf.git
|
|
116
124
|
cd mdtopdf
|
|
117
|
-
python -m pip install -e .[dev]
|
|
125
|
+
python -m pip install -e ".[dev]"
|
|
126
|
+
python -m playwright install chromium --no-shell
|
|
118
127
|
mdtopdf html examples/visual-test-en.md -o visual-test-en.html --overwrite
|
|
119
128
|
mdtopdf convert examples/visual-test-en.md -o visual-test-en.pdf --overwrite --json
|
|
120
129
|
```
|
|
@@ -122,6 +131,27 @@ mdtopdf convert examples/visual-test-en.md -o visual-test-en.pdf --overwrite --j
|
|
|
122
131
|
The same visual test is also available in Chinese at
|
|
123
132
|
`examples/visual-test-cn.md`.
|
|
124
133
|
|
|
134
|
+
## Updating
|
|
135
|
+
|
|
136
|
+
There is no `mdtopdf update` command. For a pip-installed release, activate the
|
|
137
|
+
same virtual environment (or select the same Python interpreter) used to install it:
|
|
138
|
+
|
|
139
|
+
```shell
|
|
140
|
+
python -m pip install --upgrade agent-markdown-pdf
|
|
141
|
+
python -m mdtopdf --version
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
This updates from the package index, not from the development branch.
|
|
145
|
+
For pipx or uv tool installations, use that tool's upgrade workflow instead.
|
|
146
|
+
For editable/source installs, update the intended checkout and reinstall from it;
|
|
147
|
+
do not replace a development install with a PyPI release by accident.
|
|
148
|
+
|
|
149
|
+
Pin a tested version in your deployment requirements rather than upgrading on
|
|
150
|
+
every job. After upgrading to 0.3.0 or later, run `mdtopdf doctor --render-check --json`
|
|
151
|
+
and review a representative PDF. If Playwright now needs a different managed
|
|
152
|
+
browser, follow [Browser setup](#browser-setup). Conversion does not check for
|
|
153
|
+
updates or upgrade the package/browser automatically.
|
|
154
|
+
|
|
125
155
|
## Agent workflow
|
|
126
156
|
|
|
127
157
|
The bundled agent skill lives at
|
|
@@ -133,6 +163,26 @@ mdtopdf doctor --json
|
|
|
133
163
|
mdtopdf convert report.md -o report.pdf --overwrite --json
|
|
134
164
|
```
|
|
135
165
|
|
|
166
|
+
Agents can also send UTF-8 Markdown directly to `convert -`, without saving an
|
|
167
|
+
input file. An explicit output file is required; PDF bytes are not written to stdout.
|
|
168
|
+
|
|
169
|
+
```shell
|
|
170
|
+
printf '# Report\n\nGenerated by an agent.\n' | mdtopdf convert - -o report.pdf --json
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
PowerShell (set the pipe encoding for non-ASCII text, especially in Windows PowerShell 5.1):
|
|
174
|
+
|
|
175
|
+
```powershell
|
|
176
|
+
$OutputEncoding = [System.Text.UTF8Encoding]::new($false)
|
|
177
|
+
'# Report' | mdtopdf convert - -o report.pdf --json
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Relative resources resolve from the working directory unless `--base-url` is set.
|
|
181
|
+
Use `--resource-dir` for bare attachment names and `--title` for the document title
|
|
182
|
+
and default header (otherwise `stdin`). JSON reports `input: "-"` and `source: "stdin"`.
|
|
183
|
+
Empty or non-UTF-8 input fails; `--overwrite` and `--strict` behave as with files.
|
|
184
|
+
The `html` command still takes a file path.
|
|
185
|
+
|
|
136
186
|
Use HTML preview when layout needs a quick look:
|
|
137
187
|
|
|
138
188
|
```shell
|
|
@@ -145,6 +195,24 @@ check summary, warnings, and render method. If conversion fails in JSON mode,
|
|
|
145
195
|
the error is structured enough for an agent to show the command, explain the
|
|
146
196
|
likely cause, and retry after a fix.
|
|
147
197
|
|
|
198
|
+
A successful conversion can still have warnings: a missing image, an unavailable
|
|
199
|
+
font, or an unsupported formula shown as source. Read `warnings` before handing over the PDF.
|
|
200
|
+
For jobs that must not accept these fallbacks:
|
|
201
|
+
|
|
202
|
+
```shell
|
|
203
|
+
mdtopdf convert report.md -o report.pdf --overwrite --strict --json
|
|
204
|
+
mdtopdf doctor --render-check --json
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`--strict` leaves an existing output untouched when a diagnostic is raised.
|
|
208
|
+
It is also available for file-based HTML previews. Math and Mermaid are rendered
|
|
209
|
+
to static HTML/SVG in Chromium; plain HTML export does not start a browser and
|
|
210
|
+
does not check image loading. `doctor --render-check` tests PDF, KaTeX, and Mermaid
|
|
211
|
+
together. It checks runtime health, not visual parity across machines.
|
|
212
|
+
Exit codes are `0` for success, `1` for runtime or strict-check failures, and
|
|
213
|
+
`2` for invalid arguments. Missing fonts are advisory; a missing browser or
|
|
214
|
+
bundled renderer makes the basic doctor check fail.
|
|
215
|
+
|
|
148
216
|
## Visual output
|
|
149
217
|
|
|
150
218
|
The gallery below is rendered from the final PDF produced by
|
|
@@ -163,19 +231,29 @@ pagination.
|
|
|
163
231
|
## How it works
|
|
164
232
|
|
|
165
233
|
```text
|
|
166
|
-
Markdown -> markdown-it-py HTML -> theme/custom CSS ->
|
|
234
|
+
Markdown -> markdown-it-py HTML -> theme/custom CSS -> Chromium PDF
|
|
167
235
|
```
|
|
168
236
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
237
|
+
One Chromium session renders bundled KaTeX and Mermaid, waits for fonts and
|
|
238
|
+
images, and prints the PDF. No separate Mermaid CLI, Node.js installation,
|
|
239
|
+
WeasyPrint, or MSYS2 setup is needed. Browser installation is an explicit setup
|
|
240
|
+
step; conversion never downloads a browser.
|
|
241
|
+
|
|
242
|
+
### Upgrading from 0.2.x
|
|
243
|
+
|
|
244
|
+
The command name and Python API stay the same, but the PDF engine changes from
|
|
245
|
+
WeasyPrint to Chromium. There is no WeasyPrint fallback. Install/check the browser,
|
|
246
|
+
then render a representative document before upgrading an automated workflow.
|
|
247
|
+
Page breaks, headers/footers, fonts, and custom paged-media CSS may differ.
|
|
248
|
+
JSON consumers should accept the new render-method value rather than hard-code
|
|
249
|
+
the old backend. See the [release notes](https://github.com/ABClize/mdtopdf/blob/main/CHANGELOG.md).
|
|
172
250
|
|
|
173
251
|
## Features
|
|
174
252
|
|
|
175
253
|
| Feature | Notes |
|
|
176
254
|
| --- | --- |
|
|
177
255
|
| JSON output | `--json` is available for conversion, HTML preview, doctor, and theme listing. |
|
|
178
|
-
| Environment checks | `doctor --json` checks Python imports,
|
|
256
|
+
| Environment checks | `doctor --json` checks Python imports, the browser executable, bundled KaTeX/Mermaid assets, and recommended fonts. |
|
|
179
257
|
| Local rendering | Markdown, CSS, math, Mermaid SVG generation, and PDF export stay on the machine. |
|
|
180
258
|
| HTML preview | Generate standalone HTML before PDF export for fast visual inspection. |
|
|
181
259
|
| Obsidian compatibility | Wikilinks, aliases, frontmatter hiding, comments, highlights, and typed callouts. |
|
|
@@ -246,6 +324,11 @@ mdtopdf convert report.md -o report.pdf --css print.css --base-url .
|
|
|
246
324
|
During export, `mdtopdf` checks the final CSS font stacks. Missing fonts do not
|
|
247
325
|
stop PDF generation, but they are reported in CLI warnings and in the JSON
|
|
248
326
|
`warnings` field.
|
|
327
|
+
Custom CSS also warns when its first named font is missing, even if a fallback
|
|
328
|
+
is available. Local `@font-face` files are checked for readability and CJK
|
|
329
|
+
coverage; declaring a family is not enough. Remote font sources are not fetched
|
|
330
|
+
by this static check and are reported as unverified. These checks do not replace
|
|
331
|
+
reviewing the rendered PDF. Pass `--strict` to reject warnings.
|
|
249
332
|
|
|
250
333
|
Return JSON:
|
|
251
334
|
|
|
@@ -261,6 +344,10 @@ Allow raw HTML only for trusted local Markdown:
|
|
|
261
344
|
mdtopdf convert trusted.md -o trusted.pdf --unsafe-html
|
|
262
345
|
```
|
|
263
346
|
|
|
347
|
+
HTML filtering is not a filesystem or network sandbox. Images and CSS can still
|
|
348
|
+
reference local files or remote URLs. Run untrusted documents in an environment
|
|
349
|
+
with restricted filesystem access and networking.
|
|
350
|
+
|
|
264
351
|
## Python API
|
|
265
352
|
|
|
266
353
|
```python
|
|
@@ -297,98 +384,94 @@ markdown_file_to_pdf("report.md", output_path="report.pdf", overwrite=True)
|
|
|
297
384
|
- Obsidian-style callouts such as `> [!note] Title`
|
|
298
385
|
- Safe inline HTML tags such as `<br>`, `<kbd>`, `<mark>`, `<sup>`, and `<sub>`
|
|
299
386
|
- TeX math through `$inline$`, `$$block$$`, and common `amsmath` environments
|
|
300
|
-
- Mermaid diagrams through
|
|
387
|
+
- Mermaid diagrams through bundled Mermaid in Chromium
|
|
301
388
|
|
|
302
389
|
Raw HTML is disabled by default except for the safe subset above. For trusted
|
|
303
390
|
local Markdown, pass `--unsafe-html`.
|
|
304
391
|
|
|
305
|
-
##
|
|
306
|
-
|
|
307
|
-
Install a persistent local renderer:
|
|
308
|
-
|
|
309
|
-
```shell
|
|
310
|
-
npm install -g @mermaid-js/mermaid-cli
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
`mdtopdf` does not call Mermaid.ink and does not download Mermaid CLI through
|
|
314
|
-
`npx` during conversion. Run `mdtopdf doctor --json` to check whether Mermaid
|
|
315
|
-
rendering is available.
|
|
392
|
+
## Browser setup
|
|
316
393
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
WeasyPrint also needs native libraries such as Pango, GLib, and Cairo. Linux
|
|
324
|
-
and macOS package managers usually provide them through system packages.
|
|
394
|
+
PDF export requires Chromium. HTML export also uses it when the document has
|
|
395
|
+
math or Mermaid. Browser selection is deterministic: `MDTOPDF_BROWSER_EXECUTABLE`,
|
|
396
|
+
then legacy `PUPPETEER_EXECUTABLE_PATH`, then installed Playwright Chromium,
|
|
397
|
+
then Chrome/Edge/Chromium on PATH or in common Windows/macOS installation folders.
|
|
398
|
+
Linux also checks standard installation paths. An invalid explicit path is an error,
|
|
399
|
+
not a reason to silently switch browsers. Discovery never downloads or installs anything.
|
|
325
400
|
|
|
326
|
-
|
|
327
|
-
listed before CJK fonts so ASCII digits, dates, versions, and page numbers are
|
|
328
|
-
not embedded into CJK font subsets that some Chrome/PDFium renderers handle
|
|
329
|
-
poorly. Chinese text still falls back to the CJK side of the stack.
|
|
330
|
-
|
|
331
|
-
For Linux containers or agent sandboxes, use open fonts that can be installed
|
|
332
|
-
from the distribution package manager. The recommended baseline is:
|
|
401
|
+
If no browser is available, install the managed browser once:
|
|
333
402
|
|
|
334
403
|
```shell
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
fonts-liberation \
|
|
338
|
-
fonts-dejavu-core \
|
|
339
|
-
fonts-noto-cjk \
|
|
340
|
-
fonts-stix
|
|
341
|
-
fc-cache -f
|
|
404
|
+
python -m playwright install chromium --no-shell
|
|
405
|
+
mdtopdf doctor --render-check --json
|
|
342
406
|
```
|
|
343
407
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
Code blocks prefer `Cascadia Mono` / `Cascadia Code`, then `Consolas`,
|
|
350
|
-
`Noto Sans Mono CJK SC`, `Liberation Mono`, and `DejaVu Sans Mono`. On Debian,
|
|
351
|
-
`fonts-cascadia-code` provides Cascadia fonts; on other Linux images, provide
|
|
352
|
-
Cascadia Code yourself or let the theme fall back to the installed monospace
|
|
353
|
-
fonts.
|
|
354
|
-
|
|
355
|
-
Emoji are rendered through the system emoji font. On Linux, prefer monochrome
|
|
356
|
-
`Noto Emoji` for stable PDF layout. `Noto Color Emoji` is easier to install from
|
|
357
|
-
many distro package managers and is safe to use as a fallback, but color emoji
|
|
358
|
-
often render too small or misaligned in WeasyPrint/Pango/Cairo/PDFium output.
|
|
359
|
-
|
|
360
|
-
On Windows, install the native libraries separately. A common MSYS2 setup is:
|
|
408
|
+
`doctor --json` shows the selected path and its `tools.browser.source`.
|
|
409
|
+
Use `--render-check` to verify it actually launches and renders. A browser found
|
|
410
|
+
on disk can still lack required system libraries or sandbox support.
|
|
411
|
+
An existing recent Chrome or Edge can be selected explicitly:
|
|
361
412
|
|
|
362
413
|
```powershell
|
|
363
|
-
|
|
414
|
+
$env:MDTOPDF_BROWSER_EXECUTABLE = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
|
|
415
|
+
mdtopdf doctor --render-check --json
|
|
364
416
|
```
|
|
365
417
|
|
|
366
|
-
Then install Pango from an MSYS2 MINGW64 shell:
|
|
367
|
-
|
|
368
418
|
```shell
|
|
369
|
-
|
|
419
|
+
export MDTOPDF_BROWSER_EXECUTABLE="$(command -v google-chrome)"
|
|
420
|
+
mdtopdf doctor --render-check --json
|
|
370
421
|
```
|
|
371
422
|
|
|
372
|
-
|
|
373
|
-
|
|
423
|
+
The legacy `PUPPETEER_EXECUTABLE_PATH` is accepted if the new variable is unset.
|
|
424
|
+
A fresh headless session is used; your personal browser profile is never opened.
|
|
425
|
+
Browser errors include an `error_code`, original message, and repair `hint`.
|
|
374
426
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
427
|
+
## Platform notes
|
|
428
|
+
|
|
429
|
+
Use Python 3.10+ and a recent Chromium browser. The Python Playwright package
|
|
430
|
+
includes its driver; a separate Node.js or npm installation is not required.
|
|
431
|
+
Windows and macOS no longer need an MSYS2 or Homebrew Pango setup.
|
|
378
432
|
|
|
379
|
-
|
|
380
|
-
|
|
433
|
+
On a supported Debian/Ubuntu environment, install Chromium's system libraries
|
|
434
|
+
during setup, then provide the fonts your documents use:
|
|
381
435
|
|
|
382
436
|
```shell
|
|
383
|
-
|
|
437
|
+
python -m playwright install-deps chromium
|
|
438
|
+
sudo apt-get update
|
|
439
|
+
sudo apt-get install -y --no-install-recommends \
|
|
440
|
+
fontconfig fonts-liberation fonts-dejavu-core fonts-noto-cjk fonts-stix
|
|
441
|
+
fc-cache -f
|
|
384
442
|
```
|
|
385
443
|
|
|
444
|
+
Run conversions as a **non-root** user with working browser sandbox support.
|
|
445
|
+
If Ubuntu/AppArmor blocks a downloaded browser, use an explicitly configured
|
|
446
|
+
system Chrome permitted by the host policy. Do not fix this by disabling the
|
|
447
|
+
sandbox. See [Playwright browser setup](https://playwright.dev/python/docs/browsers).
|
|
448
|
+
|
|
449
|
+
The theme keeps Latin fonts before CJK fonts. Linux uses Liberation Sans /
|
|
450
|
+
DejaVu Sans for English and digits, Noto Sans CJK SC for Chinese, and Cascadia
|
|
451
|
+
Mono / Cascadia Code for code where installed (otherwise system monospace).
|
|
452
|
+
Debian provides Cascadia through `fonts-cascadia-code`. Windows keeps its
|
|
453
|
+
existing system font stack. Microsoft YaHei and Segoe UI Emoji are not Linux
|
|
454
|
+
requirements and are never downloaded or bundled by mdtopdf.
|
|
455
|
+
|
|
456
|
+
Emoji still use installed system fonts. The existing Linux preference is
|
|
457
|
+
monochrome Noto Emoji, with Noto Color Emoji as a fallback. Browser rendering
|
|
458
|
+
removes the old WeasyPrint pipeline, but does not make every font or emoji
|
|
459
|
+
sequence identical across operating systems. Review representative PDFs.
|
|
460
|
+
KaTeX includes its own math fonts; STIX is an optional math fallback.
|
|
461
|
+
|
|
462
|
+
Images, CSS, and fonts may use local or remote resources. Document JavaScript
|
|
463
|
+
is blocked during conversion, even with `--unsafe-html`; this is not a
|
|
464
|
+
filesystem or network sandbox. Use restricted filesystem/network permissions
|
|
465
|
+
for untrusted documents. Raw HTML exported with `--unsafe-html` remains trusted
|
|
466
|
+
content when opened elsewhere.
|
|
467
|
+
|
|
386
468
|
## Development
|
|
387
469
|
|
|
388
470
|
```shell
|
|
389
471
|
git clone https://github.com/ABClize/mdtopdf.git
|
|
390
472
|
cd mdtopdf
|
|
391
|
-
python -m pip install -e .[dev]
|
|
473
|
+
python -m pip install -e ".[dev]"
|
|
474
|
+
python -m playwright install chromium --no-shell
|
|
392
475
|
python -m pytest tests/ -q
|
|
393
476
|
```
|
|
394
477
|
|
|
@@ -401,8 +484,8 @@ python -m twine check dist/*
|
|
|
401
484
|
|
|
402
485
|
## License
|
|
403
486
|
|
|
404
|
-
MIT. Bundled KaTeX
|
|
405
|
-
`mdtopdf/vendor/katex/LICENSE`.
|
|
487
|
+
MIT. Bundled KaTeX and Mermaid assets include their MIT licenses at
|
|
488
|
+
`mdtopdf/vendor/katex/LICENSE` and `mdtopdf/vendor/mermaid/LICENSE`.
|
|
406
489
|
|
|
407
490
|
`mdtopdf` does not bundle CJK body fonts, emoji fonts, or proprietary system
|
|
408
491
|
fonts. The default theme references local system fonts such as Segoe UI,
|