md2x 0.7.1 → 0.7.2
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.
- package/README.md +53 -48
- package/dist/chunks/{chunk-A4XDJ35P.js → chunk-ZHNRMGGC.js} +190 -21
- package/dist/index.js +1 -1
- package/dist/md2x.js +1 -1
- package/dist/renderer/puppeteer-render-worker.js +75 -73
- package/dist/templates/vue/mapLibre.vue +371 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,8 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
Markdown → PDF/DOCX/HTML/Image converter (local, no server). Supports Mermaid/Graphviz/Infographic/Vega/Template(vue/svelte/html) rendering, math, and code highlighting.
|
|
4
4
|
|
|
5
|
+
> Supports MCP tools and md2x skill. 🎉
|
|
6
|
+
|
|
5
7
|
[](https://www.npmjs.com/package/md2x)
|
|
6
8
|
|
|
9
|
+
## CLI Usage
|
|
10
|
+
|
|
11
|
+
Export to PDF:
|
|
12
|
+
```bash
|
|
13
|
+
npx md2x input.md
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Export to DOCX:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx md2x input.md -f docx
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Export to HTML:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx md2x input.md -f html
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Export to PNG:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx md2x input.md -f png -o output.png
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
List themes:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx md2x --list-themes
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Use a theme:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx md2x input.md -o output.pdf --theme academic
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Help:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx md2x -h
|
|
50
|
+
```
|
|
51
|
+
|
|
7
52
|
## CLI Options
|
|
8
53
|
|
|
9
54
|
| Option | Alias | Description | Default | Values |
|
|
@@ -180,6 +225,10 @@ const data = templateData;
|
|
|
180
225
|
- `template`: template file name/path
|
|
181
226
|
- if you only pass a filename (e.g. `example.vue`), it is treated as `${type}/${template}` (e.g. `vue/example.vue`)
|
|
182
227
|
- `data`: arbitrary JSON-serializable data (injected by replacing the `templateData` placeholder)
|
|
228
|
+
- `allowTemplateAssets` (optional, **unsafe**): when `true`, allow templates to load extra JS/CSS URLs declared in the template file header:
|
|
229
|
+
- `<!-- TemplateConfig: {"assets":{"scripts":["..."],"styles":["..."]}} -->`
|
|
230
|
+
- Useful for UMD/IIFE globals (e.g. `window.dayjs`), not npm-style `import`.
|
|
231
|
+
- Backward compat: `allowCdn` is accepted as an alias.
|
|
183
232
|
- `allowScripts` (optional, **unsafe**, html only): when exporting **images** in `diagramMode: "img"`, set `allowScripts: true` to execute inline `<script>` blocks before rendering to PNG.
|
|
184
233
|
- not supported: `<script type="module">`
|
|
185
234
|
- external `<script src="...">` is not supported for image rendering (use inline scripts)
|
|
@@ -209,54 +258,6 @@ cdn:
|
|
|
209
258
|
svelteBase: "https://esm.sh/svelte@5/"
|
|
210
259
|
```
|
|
211
260
|
|
|
212
|
-
|
|
213
|
-
## Usage
|
|
214
|
-
|
|
215
|
-
Export to PDF:
|
|
216
|
-
```bash
|
|
217
|
-
npx md2x input.md
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Export to DOCX:
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
npx md2x input.md -f docx
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
Export to HTML:
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
npx md2x input.md -f html
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
Export to PNG:
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
npx md2x input.md -f png -o output.png
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
List themes:
|
|
239
|
-
|
|
240
|
-
```bash
|
|
241
|
-
npx md2x --list-themes
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
Use a theme:
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
npx md2x input.md -o output.pdf --theme academic
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
Help:
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
npx md2x -h
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## MCP server (Model Context Protocol)
|
|
257
|
-
|
|
258
|
-
This repo includes an Express-based MCP server that exposes `md2x` as MCP tools over HTTP, so MCP clients can convert Markdown and download the generated HTML/PDF/DOCX from `/resources`.
|
|
259
|
-
|
|
260
261
|
## md2x Skill
|
|
261
262
|
|
|
262
263
|
This repo also includes a skill for driving `md2x` from an agent:
|
|
@@ -273,6 +274,10 @@ or
|
|
|
273
274
|
npx add-skill larchliu/md2x
|
|
274
275
|
```
|
|
275
276
|
|
|
277
|
+
## MCP server (Model Context Protocol)
|
|
278
|
+
|
|
279
|
+
This repo includes an Express-based MCP server that exposes `md2x` as MCP tools over HTTP, so MCP clients can convert Markdown and download the generated HTML/PDF/DOCX from `/resources`.
|
|
280
|
+
|
|
276
281
|
Run:
|
|
277
282
|
|
|
278
283
|
```bash
|