agent-markdown-pdf 0.1.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.1.0/LICENSE +201 -0
- agent_markdown_pdf-0.1.0/PKG-INFO +331 -0
- agent_markdown_pdf-0.1.0/README.md +290 -0
- agent_markdown_pdf-0.1.0/agent_markdown_pdf.egg-info/PKG-INFO +331 -0
- agent_markdown_pdf-0.1.0/agent_markdown_pdf.egg-info/SOURCES.txt +90 -0
- agent_markdown_pdf-0.1.0/agent_markdown_pdf.egg-info/dependency_links.txt +1 -0
- agent_markdown_pdf-0.1.0/agent_markdown_pdf.egg-info/entry_points.txt +2 -0
- agent_markdown_pdf-0.1.0/agent_markdown_pdf.egg-info/requires.txt +13 -0
- agent_markdown_pdf-0.1.0/agent_markdown_pdf.egg-info/top_level.txt +1 -0
- agent_markdown_pdf-0.1.0/mdtopdf/__init__.py +36 -0
- agent_markdown_pdf-0.1.0/mdtopdf/__main__.py +5 -0
- agent_markdown_pdf-0.1.0/mdtopdf/api.py +214 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/__init__.py +1 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/doctor.py +236 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/html.py +140 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/inline.py +85 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/katex.py +75 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/markdown.py +1034 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/mermaid.py +181 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/obsidian.py +726 -0
- agent_markdown_pdf-0.1.0/mdtopdf/core/pdf.py +147 -0
- agent_markdown_pdf-0.1.0/mdtopdf/mdtopdf_cli.py +214 -0
- agent_markdown_pdf-0.1.0/mdtopdf/skills/SKILL.md +115 -0
- agent_markdown_pdf-0.1.0/mdtopdf/themes/default.css +685 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/LICENSE +21 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/contrib/mhchem.min.js +1 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/katex.min.css +1 -0
- agent_markdown_pdf-0.1.0/mdtopdf/vendor/katex/dist/katex.min.js +1 -0
- agent_markdown_pdf-0.1.0/pyproject.toml +71 -0
- agent_markdown_pdf-0.1.0/setup.cfg +4 -0
- agent_markdown_pdf-0.1.0/tests/test_core.py +1094 -0
- agent_markdown_pdf-0.1.0/tests/test_full_e2e.py +259 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2026] [HKUDS CLI-Anything Team]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-markdown-pdf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Agent-friendly Markdown-to-PDF CLI with HTML preview and JSON diagnostics
|
|
5
|
+
Author: rainp
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/ABClize/mdtopdf
|
|
8
|
+
Project-URL: Repository, https://github.com/ABClize/mdtopdf
|
|
9
|
+
Project-URL: Issues, https://github.com/ABClize/mdtopdf/issues
|
|
10
|
+
Keywords: markdown,pdf,markdown-to-pdf,weasyprint,obsidian,cli,agent,automation,json
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Documentation
|
|
23
|
+
Classifier: Topic :: Printing
|
|
24
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: click>=8.0.0
|
|
29
|
+
Requires-Dist: markdown-it-py>=3.0.0
|
|
30
|
+
Requires-Dist: mdit-py-plugins>=0.4.0
|
|
31
|
+
Requires-Dist: pygments>=2.0.0
|
|
32
|
+
Requires-Dist: latex2mathml>=3.81.0
|
|
33
|
+
Requires-Dist: matplotlib>=3.10.0
|
|
34
|
+
Requires-Dist: mini-racer>=0.14.1
|
|
35
|
+
Requires-Dist: weasyprint>=69.0
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: build>=1.2.0; extra == "dev"
|
|
39
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
<h1 align="center">mdtopdf: Agent-friendly Markdown-to-PDF CLI</h1>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<strong>Agents write Markdown. People need PDFs. mdtopdf handles the step in between.</strong><br>
|
|
46
|
+
Local rendering, HTML preview, and JSON diagnostics give agents and scripts a stable document output path.
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<a href="https://github.com/ABClize/mdtopdf/blob/main/README_CN.md">中文文档</a>
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+
<p align="center">
|
|
54
|
+
<a href="#quick-start"><img src="https://img.shields.io/badge/Quick_Start-2_min-blue?style=for-the-badge" alt="Quick Start"></a>
|
|
55
|
+
<a href="#agent-workflow"><img src="https://img.shields.io/badge/Agent_Friendly-JSON_Output-green?style=for-the-badge" alt="Agent Friendly"></a>
|
|
56
|
+
<a href="#visual-output"><img src="https://img.shields.io/badge/PDF_Pages-Rendered-purple?style=for-the-badge" alt="Rendered PDF pages"></a>
|
|
57
|
+
<a href="https://pypi.org/project/agent-markdown-pdf/"><img src="https://img.shields.io/pypi/v/agent-markdown-pdf.svg?style=for-the-badge" alt="PyPI version"></a>
|
|
58
|
+
<a href="https://github.com/ABClize/mdtopdf/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-yellow?style=for-the-badge" alt="License"></a>
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
<p align="center">
|
|
62
|
+
<img src="https://img.shields.io/pypi/pyversions/agent-markdown-pdf.svg" alt="Python versions">
|
|
63
|
+
<img src="https://img.shields.io/badge/output-JSON_%2B_Human-blueviolet" alt="JSON and human output">
|
|
64
|
+
<img src="https://img.shields.io/badge/backend-WeasyPrint-2f855a" alt="WeasyPrint backend">
|
|
65
|
+
<img src="https://img.shields.io/badge/status-alpha-f59e0b" alt="Alpha status">
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
**One command** gives agents a controlled Markdown-to-PDF path.
|
|
69
|
+
|
|
70
|
+
<p align="center">
|
|
71
|
+
<img src="https://raw.githubusercontent.com/ABClize/mdtopdf/main/assets/readme/cover.png" alt="mdtopdf cover" width="900">
|
|
72
|
+
</p>
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Why it works for agents
|
|
77
|
+
|
|
78
|
+
Agents are good at writing Markdown. The problem is the handoff: PDFs exported
|
|
79
|
+
through ad hoc paths rarely share the same style. `mdtopdf` gives the user a
|
|
80
|
+
command-line interface where the style can be defined up front.
|
|
81
|
+
|
|
82
|
+
- **Agent-friendly** - `mdtopdf --help` is an interface description an agent can read.
|
|
83
|
+
- **JSON when it matters** - conversion, HTML preview, environment checks, and theme listing can return machine-readable output.
|
|
84
|
+
- **Local files in, local files out** - no browser dependency, no upload step, no remote rendering service.
|
|
85
|
+
- **More than plain Markdown** - Obsidian links, highlights, frontmatter, comments, and callouts are rendered.
|
|
86
|
+
|
|
87
|
+
## Quick start
|
|
88
|
+
|
|
89
|
+
Install from PyPI:
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
python -m pip install agent-markdown-pdf
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The PyPI distribution is `agent-markdown-pdf`; it installs the `mdtopdf` command.
|
|
96
|
+
|
|
97
|
+
Check the machine:
|
|
98
|
+
|
|
99
|
+
```shell
|
|
100
|
+
mdtopdf doctor --json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Convert a file:
|
|
104
|
+
|
|
105
|
+
```shell
|
|
106
|
+
mdtopdf convert report.md -o report.pdf --overwrite
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Try the bundled visual test document:
|
|
110
|
+
|
|
111
|
+
```shell
|
|
112
|
+
git clone https://github.com/ABClize/mdtopdf.git
|
|
113
|
+
cd mdtopdf
|
|
114
|
+
python -m pip install -e .[dev]
|
|
115
|
+
mdtopdf html examples/visual-test-en.md -o visual-test-en.html --overwrite
|
|
116
|
+
mdtopdf convert examples/visual-test-en.md -o visual-test-en.pdf --overwrite --json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The same visual test is also available in Chinese at
|
|
120
|
+
`examples/visual-test-cn.md`.
|
|
121
|
+
|
|
122
|
+
## Agent workflow
|
|
123
|
+
|
|
124
|
+
```shell
|
|
125
|
+
mdtopdf doctor --json
|
|
126
|
+
mdtopdf convert report.md -o report.pdf --overwrite --json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Use HTML preview when layout needs a quick look:
|
|
130
|
+
|
|
131
|
+
```shell
|
|
132
|
+
mdtopdf html report.md -o report.html --overwrite --json
|
|
133
|
+
mdtopdf convert report.md -o report.pdf --overwrite --json
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`convert --json` returns the input path, output path, file size, theme, and
|
|
137
|
+
render method. If conversion fails in JSON mode, the error is structured enough
|
|
138
|
+
for an agent to show the command, explain the likely cause, and retry after a
|
|
139
|
+
fix.
|
|
140
|
+
|
|
141
|
+
## Visual output
|
|
142
|
+
|
|
143
|
+
The gallery below is rendered from the final PDF produced by
|
|
144
|
+
`examples/visual-test-en.md`. It shows the actual pages an agent can hand back
|
|
145
|
+
to a user: headings, callouts, tables, code, math, images, Mermaid, and
|
|
146
|
+
pagination.
|
|
147
|
+
|
|
148
|
+
| Page 1 | Page 2 |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| <img src="https://raw.githubusercontent.com/ABClize/mdtopdf/main/assets/readme/pdf-page-en-1.png" alt="PDF page 1" width="420"> | <img src="https://raw.githubusercontent.com/ABClize/mdtopdf/main/assets/readme/pdf-page-en-2.png" alt="PDF page 2" width="420"> |
|
|
151
|
+
| Page 3 | Page 4 |
|
|
152
|
+
| <img src="https://raw.githubusercontent.com/ABClize/mdtopdf/main/assets/readme/pdf-page-en-3.png" alt="PDF page 3" width="420"> | <img src="https://raw.githubusercontent.com/ABClize/mdtopdf/main/assets/readme/pdf-page-en-4.png" alt="PDF page 4" width="420"> |
|
|
153
|
+
| Page 5 | Page 6 |
|
|
154
|
+
| <img src="https://raw.githubusercontent.com/ABClize/mdtopdf/main/assets/readme/pdf-page-en-5.png" alt="PDF page 5" width="420"> | <img src="https://raw.githubusercontent.com/ABClize/mdtopdf/main/assets/readme/pdf-page-en-6.png" alt="PDF page 6" width="420"> |
|
|
155
|
+
|
|
156
|
+
## How it works
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
Markdown -> markdown-it-py HTML -> theme/custom CSS -> WeasyPrint PDF
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Mermaid rendering is optional. If a local `mmdc` command exists, Mermaid blocks
|
|
163
|
+
render to SVG. If it is missing, conversion still succeeds and Mermaid blocks
|
|
164
|
+
remain visible as highlighted code.
|
|
165
|
+
|
|
166
|
+
## Features
|
|
167
|
+
|
|
168
|
+
| Feature | Notes |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| JSON output | `--json` is available for conversion, HTML preview, doctor, and theme listing. |
|
|
171
|
+
| Environment checks | `doctor --json` checks Python imports, native WeasyPrint libraries, Windows DLL paths, and Mermaid availability. |
|
|
172
|
+
| Local rendering | Markdown, CSS, math, Mermaid SVG generation, and PDF export stay on the machine. |
|
|
173
|
+
| HTML preview | Generate standalone HTML before PDF export for fast visual inspection. |
|
|
174
|
+
| Obsidian compatibility | Wikilinks, aliases, frontmatter hiding, comments, highlights, and typed callouts. |
|
|
175
|
+
| Document Markdown | Tables, task lists, footnotes, heading anchors, fenced code, and Pygments highlighting. |
|
|
176
|
+
| KaTeX math | Inline and block TeX render with bundled KaTeX assets, without a CDN. |
|
|
177
|
+
| Safe HTML default | Common inline document tags are allowed; unsafe raw HTML stays escaped unless opted in. |
|
|
178
|
+
| Python API | Convert Markdown strings or files from your own code. |
|
|
179
|
+
|
|
180
|
+
## Commands
|
|
181
|
+
|
|
182
|
+
Render a PDF:
|
|
183
|
+
|
|
184
|
+
```shell
|
|
185
|
+
mdtopdf convert report.md -o report.pdf
|
|
186
|
+
mdtopdf convert report.md -o report.pdf --overwrite
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Preview HTML:
|
|
190
|
+
|
|
191
|
+
```shell
|
|
192
|
+
mdtopdf html report.md -o report.html --overwrite
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Set document metadata and page chrome:
|
|
196
|
+
|
|
197
|
+
```shell
|
|
198
|
+
mdtopdf convert report.md -o report.pdf --title "Report"
|
|
199
|
+
mdtopdf convert report.md -o report.pdf --header "Report" --footer "Draft"
|
|
200
|
+
mdtopdf convert report.md -o report.pdf --no-header --no-footer
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Use extra CSS or resource lookup paths:
|
|
204
|
+
|
|
205
|
+
```shell
|
|
206
|
+
mdtopdf convert report.md -o report.pdf --css print.css
|
|
207
|
+
mdtopdf convert report.md -o report.pdf --base-url assets
|
|
208
|
+
mdtopdf convert report.md -o report.pdf --resource-dir attachments
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Return JSON:
|
|
212
|
+
|
|
213
|
+
```shell
|
|
214
|
+
mdtopdf --json convert report.md -o report.pdf --overwrite
|
|
215
|
+
mdtopdf doctor --json
|
|
216
|
+
mdtopdf themes list --json
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Allow raw HTML only for trusted local Markdown:
|
|
220
|
+
|
|
221
|
+
```shell
|
|
222
|
+
mdtopdf convert trusted.md -o trusted.pdf --unsafe-html
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Python API
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
from mdtopdf import (
|
|
229
|
+
markdown_file_to_html,
|
|
230
|
+
markdown_file_to_pdf,
|
|
231
|
+
markdown_to_html,
|
|
232
|
+
markdown_to_pdf,
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
rendered = markdown_to_html("# Report\n\n==highlight==")
|
|
236
|
+
print(rendered.html)
|
|
237
|
+
|
|
238
|
+
markdown_to_pdf("# Report\n\nBody", "report.pdf", title="Report", overwrite=True)
|
|
239
|
+
markdown_file_to_html("report.md", output_path="report.html", overwrite=True)
|
|
240
|
+
markdown_file_to_pdf("report.md", output_path="report.pdf", overwrite=True)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Markdown support
|
|
244
|
+
|
|
245
|
+
`mdtopdf` supports:
|
|
246
|
+
|
|
247
|
+
- CommonMark
|
|
248
|
+
- Tables
|
|
249
|
+
- Strikethrough
|
|
250
|
+
- Task lists
|
|
251
|
+
- Footnotes
|
|
252
|
+
- Heading anchors
|
|
253
|
+
- Fenced code blocks with Pygments highlighting
|
|
254
|
+
- Obsidian-style `==highlight==` marks
|
|
255
|
+
- Obsidian-style `[[target|alias]]` wikilinks
|
|
256
|
+
- Obsidian-style `%%comment%%` comments outside code
|
|
257
|
+
- Obsidian/YAML frontmatter hiding at the start of the file
|
|
258
|
+
- Obsidian-style callouts such as `> [!note] Title`
|
|
259
|
+
- Safe inline HTML tags such as `<br>`, `<kbd>`, `<mark>`, `<sup>`, and `<sub>`
|
|
260
|
+
- TeX math through `$inline$`, `$$block$$`, and common `amsmath` environments
|
|
261
|
+
- Mermaid diagrams through local `mmdc`, when installed
|
|
262
|
+
|
|
263
|
+
Raw HTML is disabled by default except for the safe subset above. For trusted
|
|
264
|
+
local Markdown, pass `--unsafe-html`.
|
|
265
|
+
|
|
266
|
+
## Mermaid diagrams
|
|
267
|
+
|
|
268
|
+
Install a persistent local renderer:
|
|
269
|
+
|
|
270
|
+
```shell
|
|
271
|
+
npm install -g @mermaid-js/mermaid-cli
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
`mdtopdf` does not call Mermaid.ink and does not download Mermaid CLI through
|
|
275
|
+
`npx` during conversion. Run `mdtopdf doctor --json` to check whether Mermaid
|
|
276
|
+
rendering is available.
|
|
277
|
+
|
|
278
|
+
## Platform notes
|
|
279
|
+
|
|
280
|
+
`mdtopdf` requires Python 3.10+ and installs its Python dependencies from PyPI:
|
|
281
|
+
`click`, `markdown-it-py`, `mdit-py-plugins`, `pygments`, `latex2mathml`,
|
|
282
|
+
`matplotlib`, `mini-racer`, and `weasyprint`.
|
|
283
|
+
|
|
284
|
+
WeasyPrint also needs native libraries such as Pango, GLib, and Cairo. Linux
|
|
285
|
+
and macOS package managers usually provide them through system packages.
|
|
286
|
+
|
|
287
|
+
On Windows, install the native libraries separately. A common MSYS2 setup is:
|
|
288
|
+
|
|
289
|
+
```powershell
|
|
290
|
+
winget install MSYS2.MSYS2
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
Then install Pango from an MSYS2 MINGW64 shell:
|
|
294
|
+
|
|
295
|
+
```shell
|
|
296
|
+
pacman -S mingw-w64-x86_64-pango
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Finally, point WeasyPrint at the DLL directory from PowerShell. Adjust the path
|
|
300
|
+
if MSYS2 is installed somewhere else:
|
|
301
|
+
|
|
302
|
+
```powershell
|
|
303
|
+
setx WEASYPRINT_DLL_DIRECTORIES "C:\msys64\mingw64\bin"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Run this after installation:
|
|
307
|
+
|
|
308
|
+
```shell
|
|
309
|
+
mdtopdf doctor --json
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Development
|
|
313
|
+
|
|
314
|
+
```shell
|
|
315
|
+
git clone https://github.com/ABClize/mdtopdf.git
|
|
316
|
+
cd mdtopdf
|
|
317
|
+
python -m pip install -e .[dev]
|
|
318
|
+
python -m pytest tests/ -q
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Build and check the package:
|
|
322
|
+
|
|
323
|
+
```shell
|
|
324
|
+
python -m build
|
|
325
|
+
python -m twine check dist/*
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## License
|
|
329
|
+
|
|
330
|
+
Apache-2.0. Bundled KaTeX assets are distributed under the MIT license; see
|
|
331
|
+
`mdtopdf/vendor/katex/LICENSE`.
|