md2x 0.7.4 → 0.7.6
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 +61 -23
- package/dist/chunks/chunk-Q6QMPHEY.js +1552 -0
- package/dist/chunks/chunk-UZ7TETMS.js +415 -0
- package/dist/chunks/docx-exporter-GL6CNCQD.js +1 -0
- package/dist/chunks/mcp-server-4TPUOZXJ.js +49 -0
- package/dist/core-worker.js +1764 -0
- package/dist/index.js +1 -1
- package/dist/md2x.js +8 -5
- package/dist/renderer/core-worker-browser.js +1775 -0
- package/dist/renderer/live-runtime-canvas.js +1 -1
- package/dist/renderer/live-runtime-dot.js +1 -1
- package/dist/renderer/live-runtime-html.js +1 -1
- package/dist/renderer/live-runtime-infographic.js +1 -1
- package/dist/renderer/live-runtime-md2x.js +4 -4
- package/dist/renderer/live-runtime-mermaid.js +1 -1
- package/dist/renderer/live-runtime-svg.js +1 -1
- package/dist/renderer/live-runtime-vega.js +1 -1
- 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 -49
- package/dist/types/node/src/host/node-exporter.d.ts +1 -90
- 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/package.json +13 -3
- 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-FXZD57XY.js +0 -532
- 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-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/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)**: built-in MCP server
|
|
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:
|
|
@@ -245,10 +250,11 @@ const data = templateData;
|
|
|
245
250
|
|
|
246
251
|
### Template Resolution (External Templates)
|
|
247
252
|
|
|
248
|
-
To load templates from outside
|
|
253
|
+
To load templates from outside, use:
|
|
249
254
|
|
|
250
|
-
- CLI: `--templates-dir /path/to/templates` (repeatable)
|
|
251
|
-
-
|
|
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)
|
|
252
258
|
|
|
253
259
|
### CDN Overrides (Live Mode)
|
|
254
260
|
|
|
@@ -278,34 +284,66 @@ or
|
|
|
278
284
|
npx add-skill larchliu/md2x
|
|
279
285
|
```
|
|
280
286
|
|
|
281
|
-
## MCP
|
|
287
|
+
## MCP Server (Model Context Protocol)
|
|
282
288
|
|
|
283
|
-
|
|
289
|
+
The md2x CLI includes a built-in MCP server that exposes markdown conversion as MCP tools via stdio transport.
|
|
284
290
|
|
|
285
|
-
|
|
291
|
+
### Starting the MCP Server
|
|
286
292
|
|
|
287
293
|
```bash
|
|
288
|
-
|
|
289
|
-
|
|
294
|
+
npx md2x --mcp
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Or if installed globally:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
md2x --mcp
|
|
290
301
|
```
|
|
291
302
|
|
|
292
|
-
|
|
303
|
+
### Available Tools
|
|
304
|
+
|
|
305
|
+
- **`convert_markdown`**: Convert markdown files to PDF, DOCX, HTML, or Image formats
|
|
306
|
+
- Takes a `markdownFilePath` parameter
|
|
307
|
+
- Saves output to the same directory as the source file (or custom `outputPath`)
|
|
308
|
+
- Returns the file path to the converted document
|
|
309
|
+
|
|
310
|
+
- **`list_themes`**: List all available themes with their categories and featured status
|
|
293
311
|
|
|
294
|
-
|
|
295
|
-
- Legacy HTTP+SSE: `GET /sse` and `POST /messages?sessionId=...`
|
|
296
|
-
- Resources (static files): `GET /resources/*`
|
|
312
|
+
### Integration with Claude Desktop
|
|
297
313
|
|
|
298
|
-
|
|
314
|
+
Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
299
315
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
316
|
+
```json
|
|
317
|
+
{
|
|
318
|
+
"mcpServers": {
|
|
319
|
+
"md2x": {
|
|
320
|
+
"command": "node",
|
|
321
|
+
"args": ["/path/to/markdown-viewer-extension/node/dist/md2x.js", "--mcp"]
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
```
|
|
304
326
|
|
|
305
|
-
|
|
327
|
+
### Testing
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
node --test test/mcp-server.test.mjs
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
See [MCP-SERVER.md](MCP-SERVER.md) for detailed documentation.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## HTTP-based MCP Server (Separate Package)
|
|
338
|
+
|
|
339
|
+
There's also a separate Express-based MCP server in the `mcp/` directory that exposes `md2x` as MCP tools over HTTP:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
pnpm -C mcp install
|
|
343
|
+
pnpm -C mcp start
|
|
344
|
+
```
|
|
306
345
|
|
|
307
|
-
|
|
308
|
-
- Config: `PORT` (default `3000`) and `MD2X_BASE_URL` (used to build the public `/resources` URL). See `mcp/README.md`.
|
|
346
|
+
See `mcp/README.md` for details.
|
|
309
347
|
|
|
310
348
|
## Puppeteer / Chrome install
|
|
311
349
|
|