md2x 0.7.3 → 0.7.5
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 +17 -7
- package/dist/chunks/chunk-54X5GPSM.js +1552 -0
- package/dist/chunks/chunk-US45GBOT.js +415 -0
- package/dist/chunks/docx-exporter-7C6T4DFB.js +1 -0
- package/dist/core-worker.js +1764 -0
- package/dist/index.js +1 -1
- package/dist/md2x.js +7 -5
- package/dist/renderer/core-worker-browser.js +1775 -0
- package/dist/renderer/live-runtime-canvas.js +24 -0
- package/dist/renderer/live-runtime-core.js +14 -0
- package/dist/renderer/live-runtime-dot.js +27 -0
- package/dist/renderer/live-runtime-html.js +14 -0
- package/dist/renderer/live-runtime-infographic.js +593 -0
- package/dist/renderer/live-runtime-md2x.js +24 -0
- package/dist/renderer/live-runtime-mermaid.js +14 -0
- package/dist/renderer/live-runtime-svg.js +14 -0
- package/dist/renderer/live-runtime-vega.js +218 -0
- package/dist/renderer/puppeteer-render.html +9 -1
- package/dist/renderer/puppeteer-runtime-core.js +14 -0
- package/dist/types/node/src/host/browser-renderer.d.ts +1 -175
- package/dist/types/node/src/host/core.d.ts +59 -0
- package/dist/types/node/src/host/index.d.ts +4 -47
- package/dist/types/node/src/host/node-exporter.d.ts +1 -84
- package/dist/types/node/src/host/node-platform.d.ts +1 -23
- package/dist/types/node/src/host/templates-data.d.ts +5 -0
- package/dist/types/node/src/host/themes-data.d.ts +2385 -0
- package/dist/types/node/src/host/types.d.ts +251 -0
- package/dist/types/node/src/index.d.ts +2 -3
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/render.d.ts +12 -0
- package/package.json +10 -2
- package/dist/chunks/chunk-2LPNL4GA.js +0 -1
- package/dist/chunks/chunk-3P5X57NT.js +0 -262
- package/dist/chunks/chunk-3VL755NO.js +0 -1
- package/dist/chunks/chunk-5DPTQTJJ.js +0 -1
- package/dist/chunks/chunk-AK6TXLWO.js +0 -1
- package/dist/chunks/chunk-CN4F5HOV.js +0 -5
- package/dist/chunks/chunk-CVKZIRZW.js +0 -5
- package/dist/chunks/chunk-DFROP2PD.js +0 -11
- package/dist/chunks/chunk-DJGIYXVP.js +0 -3
- package/dist/chunks/chunk-EFKQH5UR.js +0 -108
- package/dist/chunks/chunk-IENSDROB.js +0 -1
- package/dist/chunks/chunk-LLCWR7UA.js +0 -1
- package/dist/chunks/chunk-MHCTK6WW.js +0 -1
- package/dist/chunks/chunk-NM6J3ND7.js +0 -1
- package/dist/chunks/chunk-PARPCLXM.js +0 -1
- package/dist/chunks/chunk-PUOHPY5L.js +0 -16
- package/dist/chunks/chunk-R65AQGTF.js +0 -1
- package/dist/chunks/chunk-R6G2575A.js +0 -3
- package/dist/chunks/chunk-RLHZRADD.js +0 -1391
- package/dist/chunks/chunk-TRGQPVRY.js +0 -2
- package/dist/chunks/chunk-URO5RPHJ.js +0 -9
- package/dist/chunks/chunk-YFL3W3OS.js +0 -1
- package/dist/chunks/chunk-Z4LVGK7Y.js +0 -1
- package/dist/chunks/docx-exporter-ZZ76JXFU.js +0 -1
- package/dist/chunks/rehype-highlight-Y4Q4RX67.js +0 -1
- package/dist/chunks/rehype-katex-FXTCTSUE.js +0 -1
- package/dist/chunks/rehype-stringify-4CQSSRDL.js +0 -1
- package/dist/chunks/remark-gfm-BUZ4SLP3.js +0 -1
- package/dist/chunks/remark-math-HEZQAPFK.js +0 -1
- package/dist/chunks/remark-parse-QC7TSXTK.js +0 -1
- package/dist/chunks/remark-rehype-C2LX643P.js +0 -1
- package/dist/chunks/remark-super-sub-EP2AQS54.js +0 -1
- package/dist/chunks/theme-manager-AZBU2SLL.js +0 -1
- package/dist/chunks/theme-to-css-GLV3WYDU.js +0 -85
- package/dist/chunks/unified-PU53JLVJ.js +0 -1
- package/dist/chunks/unist-util-visit-SBSD62C6.js +0 -1
- package/dist/renderer/puppeteer-render-worker.js +0 -830
- package/dist/templates/html/example.html +0 -35
- package/dist/templates/svelte/example.svelte +0 -18
- package/dist/templates/vue/PrinterComponent.vue +0 -875
- package/dist/templates/vue/example.vue +0 -17
- package/dist/templates/vue/mapLibre.vue +0 -371
- package/dist/themes/code-themes/business-contrast.json +0 -31
- package/dist/themes/code-themes/colorful.json +0 -32
- package/dist/themes/code-themes/cool-modern.json +0 -31
- package/dist/themes/code-themes/high-contrast.json +0 -31
- package/dist/themes/code-themes/light-clean.json +0 -31
- package/dist/themes/code-themes/warm-book.json +0 -31
- package/dist/themes/color-schemes/candy.json +0 -34
- package/dist/themes/color-schemes/cool.json +0 -34
- package/dist/themes/color-schemes/coral.json +0 -34
- package/dist/themes/color-schemes/dino.json +0 -34
- package/dist/themes/color-schemes/forest.json +0 -34
- package/dist/themes/color-schemes/garden.json +0 -34
- package/dist/themes/color-schemes/neutral.json +0 -34
- package/dist/themes/color-schemes/ocean.json +0 -34
- package/dist/themes/color-schemes/rainbow.json +0 -43
- package/dist/themes/color-schemes/sakura.json +0 -34
- package/dist/themes/color-schemes/sepia.json +0 -34
- package/dist/themes/color-schemes/space.json +0 -34
- package/dist/themes/color-schemes/starry.json +0 -34
- package/dist/themes/color-schemes/sunset.json +0 -34
- package/dist/themes/color-schemes/warm.json +0 -34
- package/dist/themes/font-config.json +0 -184
- package/dist/themes/layout-schemes/academic.json +0 -40
- package/dist/themes/layout-schemes/book.json +0 -40
- package/dist/themes/layout-schemes/document.json +0 -40
- package/dist/themes/layout-schemes/magazine.json +0 -40
- package/dist/themes/layout-schemes/student.json +0 -40
- package/dist/themes/layout-schemes/technical.json +0 -40
- package/dist/themes/presets/academic.json +0 -24
- package/dist/themes/presets/business.json +0 -22
- package/dist/themes/presets/candy.json +0 -23
- package/dist/themes/presets/century.json +0 -22
- package/dist/themes/presets/coral.json +0 -22
- package/dist/themes/presets/default.json +0 -22
- package/dist/themes/presets/dinosaur.json +0 -23
- package/dist/themes/presets/elegant.json +0 -22
- package/dist/themes/presets/forest.json +0 -22
- package/dist/themes/presets/garamond.json +0 -22
- package/dist/themes/presets/garden.json +0 -23
- package/dist/themes/presets/handwritten.json +0 -23
- package/dist/themes/presets/heiti.json +0 -22
- package/dist/themes/presets/magazine.json +0 -24
- package/dist/themes/presets/manuscript.json +0 -22
- package/dist/themes/presets/minimal.json +0 -22
- package/dist/themes/presets/mixed.json +0 -24
- package/dist/themes/presets/newspaper.json +0 -24
- package/dist/themes/presets/ocean.json +0 -22
- package/dist/themes/presets/palatino.json +0 -22
- package/dist/themes/presets/rainbow.json +0 -23
- package/dist/themes/presets/space.json +0 -23
- package/dist/themes/presets/starry.json +0 -23
- package/dist/themes/presets/sunset.json +0 -22
- package/dist/themes/presets/swiss.json +0 -22
- package/dist/themes/presets/technical.json +0 -22
- package/dist/themes/presets/typewriter.json +0 -23
- package/dist/themes/presets/verdana.json +0 -22
- package/dist/themes/presets/water.json +0 -22
- package/dist/themes/registry.json +0 -270
- package/dist/themes/table-styles/academic.json +0 -30
- package/dist/themes/table-styles/borderless.json +0 -26
- package/dist/themes/table-styles/compact.json +0 -24
- package/dist/themes/table-styles/grid.json +0 -22
- package/dist/themes/table-styles/high-contrast.json +0 -22
- package/dist/themes/table-styles/minimal-gray.json +0 -26
- package/dist/themes/table-styles/modern-tech.json +0 -34
- package/dist/themes/table-styles/professional.json +0 -34
- package/dist/themes/table-styles/zebra.json +0 -22
- package/dist/types/src/utils/theme-to-css.d.ts +0 -171
package/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# md2x
|
|
2
2
|
|
|
3
|
-
Markdown → PDF/DOCX/HTML/Image converter
|
|
4
|
-
|
|
5
|
-
> Supports MCP tools and md2x skill. 🎉
|
|
3
|
+
Markdown → PDF/DOCX/HTML/Image converter.
|
|
6
4
|
|
|
7
5
|
[](https://www.npmjs.com/package/md2x)
|
|
8
6
|
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 📦 **Supported formats**: `pdf`, `docx`, `html`, `png`, `jpg/jpeg`, `webp`
|
|
10
|
+
- 🔌 **MCP (Model Context Protocol)**: run `mcp/` server to expose Markdown conversion as MCP tools
|
|
11
|
+
- 🧠 **Skills**: includes an agent skill at `skills/md2x/SKILL.md` for repeatable conversions/workflows
|
|
12
|
+
- 🧩 **Custom templates**: render `md2x` blocks with **Vue SFC** (`.vue`) and **Svelte 5** (`.svelte`) templates (plus plain HTML)
|
|
13
|
+
|
|
9
14
|
## CLI Usage
|
|
10
15
|
|
|
11
16
|
Export to PDF:
|
|
@@ -59,13 +64,15 @@ npx md2x -h
|
|
|
59
64
|
| `--format` | `-f` | Output format | `pdf` | `pdf`, `docx`, `html`, `png`, `jpg/jpeg`, `webp` |
|
|
60
65
|
| `--theme` | `-t` | Theme name | `default` | See `--list-themes` |
|
|
61
66
|
| `--diagram-mode` | - | HTML/Image diagram rendering mode | `live` | `img`, `live`, `none` |
|
|
67
|
+
| `--live-runtime` | - | HTML live runtime injection strategy (only when `diagramMode: live`) | `cdn` | `inline`, `cdn` |
|
|
68
|
+
| `--live-runtime-url` | - | Custom runtime URL when `--live-runtime cdn` | - | URL |
|
|
62
69
|
| `--hr-page-break` | - | Convert horizontal rules to page breaks | `true` for PDF/DOCX, `false` for HTML/Image | `true`, `false` |
|
|
63
70
|
| `--templates-dir` | - | Extra template dir for md2x blocks (repeatable; resolved against input dir when relative) | - | Directory path |
|
|
64
71
|
| `--list-themes` | - | List all available themes | - | - |
|
|
65
72
|
|
|
66
73
|
### Diagram Modes (HTML/Image)
|
|
67
74
|
|
|
68
|
-
- **`live`** (default): Render diagrams in the browser on load using
|
|
75
|
+
- **`live`** (default): Render diagrams in the browser on load using the md2x live runtime (by default it is embedded into the output HTML; see `liveRuntime` below)
|
|
69
76
|
- **`img`**: Pre-render diagrams as embedded images (offline, stable; no CDN)
|
|
70
77
|
- **`none`**: Keep diagram source blocks only (no rendering)
|
|
71
78
|
|
|
@@ -124,6 +131,8 @@ title: "My Doc"
|
|
|
124
131
|
standalone: true # full HTML document (default)
|
|
125
132
|
baseTag: true # emit <base href="file://.../"> for resolving relative paths (default)
|
|
126
133
|
diagramMode: live # img | live | none
|
|
134
|
+
liveRuntime: cdn # inline | cdn (default: cdn). Use "inline" for fully self-contained HTML.
|
|
135
|
+
# liveRuntimeUrl: "https://cdn.jsdelivr.net/npm/md2x@0.7.3/dist/renderer/" # chunked runtime base URL
|
|
127
136
|
cdn: # optional: override CDN URLs (used when diagramMode: live)
|
|
128
137
|
mermaid: "https://cdn.jsdelivr.net/npm/mermaid@11.12.2/dist/mermaid.min.js"
|
|
129
138
|
# Template blocks:
|
|
@@ -241,10 +250,11 @@ const data = templateData;
|
|
|
241
250
|
|
|
242
251
|
### Template Resolution (External Templates)
|
|
243
252
|
|
|
244
|
-
To load templates from outside
|
|
253
|
+
To load templates from outside, use:
|
|
245
254
|
|
|
246
|
-
- CLI: `--templates-dir /path/to/templates` (repeatable)
|
|
247
|
-
-
|
|
255
|
+
- CLI: `--templates-dir /path/to/templates` (repeatable; CLI reads files and passes them as `templates`)
|
|
256
|
+
- Library API: pass `templates: Record<string, string>` (you can load files yourself if you want)
|
|
257
|
+
- Front matter: `templates:` supports inline template sources (YAML map)
|
|
248
258
|
|
|
249
259
|
### CDN Overrides (Live Mode)
|
|
250
260
|
|