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
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for markdown conversion - Web Worker compatible
|
|
3
|
+
*/
|
|
4
|
+
import type { RendererThemeConfig } from '../../../src/types/index';
|
|
5
|
+
export type { RendererThemeConfig };
|
|
6
|
+
export type OutputFormat = 'docx' | 'pdf' | 'html' | 'png' | 'jpg' | 'jpeg' | 'webp';
|
|
7
|
+
export type DiagramMode = 'img' | 'live' | 'none';
|
|
8
|
+
export type FrontMatterData = Record<string, unknown>;
|
|
9
|
+
export interface ImageOptions {
|
|
10
|
+
/** Output image type (default: "png") */
|
|
11
|
+
type?: 'png' | 'jpeg' | 'webp';
|
|
12
|
+
/** Image quality, 0-100 (only for jpeg/webp) */
|
|
13
|
+
quality?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Clamp the output bitmap width (in physical pixels) by lowering the deviceScaleFactor.
|
|
16
|
+
* Default: 2000. Set to 0 to disable.
|
|
17
|
+
*/
|
|
18
|
+
maxPixelWidth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Split very tall pages into multiple images.
|
|
21
|
+
* - `false`: always export a single image
|
|
22
|
+
* - `true`: always split when `fullPage: true`
|
|
23
|
+
* - `"auto"` (default): split only when the page is too tall
|
|
24
|
+
*/
|
|
25
|
+
split?: boolean | 'auto';
|
|
26
|
+
/** Maximum slice height in physical pixels (default: 14000) */
|
|
27
|
+
splitMaxPixelHeight?: number;
|
|
28
|
+
/** Overlap between slices in CSS px (default: 0) */
|
|
29
|
+
splitOverlapPx?: number;
|
|
30
|
+
/** Capture the full scrollable page (default: true) */
|
|
31
|
+
fullPage?: boolean;
|
|
32
|
+
/** Capture a specific element instead of the full page (CSS selector) */
|
|
33
|
+
selector?: string | string[];
|
|
34
|
+
/** How to handle selectors that match multiple elements */
|
|
35
|
+
selectorMode?: 'first' | 'each' | 'union' | 'stitch';
|
|
36
|
+
/** Extra padding (CSS px) around the selected element */
|
|
37
|
+
selectorPadding?: number;
|
|
38
|
+
/** Vertical gap (CSS px) between elements when `selectorMode: "stitch"` */
|
|
39
|
+
selectorGap?: number;
|
|
40
|
+
/** Pre-scroll the page to trigger lazy-loading before taking a screenshot */
|
|
41
|
+
scrollToLoad?: boolean;
|
|
42
|
+
/** Fine-tune the scroll behavior when `scrollToLoad` is enabled */
|
|
43
|
+
scroll?: {
|
|
44
|
+
stepPx?: number;
|
|
45
|
+
delayMs?: number;
|
|
46
|
+
maxSteps?: number;
|
|
47
|
+
maxTimeMs?: number;
|
|
48
|
+
};
|
|
49
|
+
/** Omit the default white background (PNG only; default: false) */
|
|
50
|
+
omitBackground?: boolean;
|
|
51
|
+
/** Capture screenshot from the surface (GPU composited) or the view */
|
|
52
|
+
fromSurface?: boolean;
|
|
53
|
+
/** Capture beyond viewport setting */
|
|
54
|
+
captureBeyondViewport?: boolean;
|
|
55
|
+
/** Viewport settings */
|
|
56
|
+
viewport?: {
|
|
57
|
+
width?: number;
|
|
58
|
+
height?: number;
|
|
59
|
+
deviceScaleFactor?: number;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface PdfOptions {
|
|
63
|
+
format?: 'A4' | 'Letter' | 'Legal' | 'A3' | 'A5';
|
|
64
|
+
landscape?: boolean;
|
|
65
|
+
margin?: {
|
|
66
|
+
top?: string | number;
|
|
67
|
+
bottom?: string | number;
|
|
68
|
+
left?: string | number;
|
|
69
|
+
right?: string | number;
|
|
70
|
+
};
|
|
71
|
+
printBackground?: boolean;
|
|
72
|
+
scale?: number;
|
|
73
|
+
displayHeaderFooter?: boolean;
|
|
74
|
+
/** HTML template for the print header */
|
|
75
|
+
headerTemplate?: string;
|
|
76
|
+
/** HTML template for the print footer */
|
|
77
|
+
footerTemplate?: string;
|
|
78
|
+
/** Custom page width (e.g., '800px') */
|
|
79
|
+
width?: string;
|
|
80
|
+
/** Custom page height (e.g., '600px') */
|
|
81
|
+
height?: string;
|
|
82
|
+
/** Document title for header template */
|
|
83
|
+
title?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface FrontMatterOptions {
|
|
86
|
+
theme?: string;
|
|
87
|
+
format?: OutputFormat;
|
|
88
|
+
hrAsPageBreak?: boolean;
|
|
89
|
+
image?: ImageOptions;
|
|
90
|
+
title?: string;
|
|
91
|
+
standalone?: boolean;
|
|
92
|
+
diagramMode?: DiagramMode;
|
|
93
|
+
baseTag?: boolean;
|
|
94
|
+
liveRuntime?: 'inline' | 'cdn';
|
|
95
|
+
liveRuntimeBaseUrl?: string;
|
|
96
|
+
cdn?: Partial<{
|
|
97
|
+
mermaid: string;
|
|
98
|
+
vue: string;
|
|
99
|
+
vueSfcLoader: string;
|
|
100
|
+
svelteCompiler: string;
|
|
101
|
+
svelteBase: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Pre-loaded md2x template sources, keyed by template ref.
|
|
105
|
+
*
|
|
106
|
+
* Common keys:
|
|
107
|
+
* - "vue/my-component.vue"
|
|
108
|
+
* - "svelte/my-widget.svelte"
|
|
109
|
+
* - "html/my-template.html"
|
|
110
|
+
*
|
|
111
|
+
* You may also include the raw `template:` value (e.g. "my-component.vue") as an additional key.
|
|
112
|
+
*/
|
|
113
|
+
templates?: Record<string, string>;
|
|
114
|
+
pdf?: PdfOptions;
|
|
115
|
+
}
|
|
116
|
+
export interface CdnOptions {
|
|
117
|
+
/** CDN base URL for md2x runtime (default: jsdelivr) */
|
|
118
|
+
runtimeBaseUrl?: string;
|
|
119
|
+
/** Mermaid CDN URL */
|
|
120
|
+
mermaidUrl?: string;
|
|
121
|
+
/** md2x package version for CDN */
|
|
122
|
+
md2xVersion?: string;
|
|
123
|
+
/** CDN overrides for diagram libraries */
|
|
124
|
+
cdn?: Partial<{
|
|
125
|
+
mermaid: string;
|
|
126
|
+
vue: string;
|
|
127
|
+
vueSfcLoader: string;
|
|
128
|
+
svelteCompiler: string;
|
|
129
|
+
svelteBase: string;
|
|
130
|
+
}>;
|
|
131
|
+
}
|
|
132
|
+
export interface MarkdownToHtmlStringOptions {
|
|
133
|
+
title?: string;
|
|
134
|
+
/** Theme ID (e.g., 'default', 'academic') */
|
|
135
|
+
theme?: string;
|
|
136
|
+
/** KaTeX version for CDN */
|
|
137
|
+
katexVersion?: string;
|
|
138
|
+
/** Additional CSS to inject */
|
|
139
|
+
css?: string;
|
|
140
|
+
/** Additional head content (e.g., custom stylesheets) */
|
|
141
|
+
head?: string;
|
|
142
|
+
/** Enable live diagram rendering (mermaid, graphviz, etc.) */
|
|
143
|
+
liveDiagrams?: boolean;
|
|
144
|
+
/** CDN URL options */
|
|
145
|
+
cdn?: CdnOptions;
|
|
146
|
+
/** Treat hr as page break */
|
|
147
|
+
hrAsPageBreak?: boolean;
|
|
148
|
+
/** Base href for resolving relative URLs */
|
|
149
|
+
baseHref?: string;
|
|
150
|
+
/** Theme config for renderers */
|
|
151
|
+
themeConfig?: RendererThemeConfig | null;
|
|
152
|
+
/** Pre-loaded md2x template files */
|
|
153
|
+
md2xTemplateFiles?: Record<string, string>;
|
|
154
|
+
}
|
|
155
|
+
export interface RenderResult {
|
|
156
|
+
base64: string;
|
|
157
|
+
width: number;
|
|
158
|
+
height: number;
|
|
159
|
+
format: string;
|
|
160
|
+
}
|
|
161
|
+
export interface BrowserRenderer {
|
|
162
|
+
initialize(): Promise<void>;
|
|
163
|
+
render(type: string, content: string | object, basePath?: string, themeConfig?: RendererThemeConfig | null): Promise<RenderResult | null>;
|
|
164
|
+
exportToPdf(html: string, css: string, options?: PdfOptions, basePath?: string): Promise<Buffer>;
|
|
165
|
+
exportToImage(html: string, css: string, options?: ImageOptions, basePath?: string): Promise<Buffer>;
|
|
166
|
+
exportToImageParts(html: string, css: string, options?: ImageOptions, basePath?: string): Promise<Buffer[]>;
|
|
167
|
+
close(): Promise<void>;
|
|
168
|
+
}
|
|
169
|
+
export interface Md2xTemplateConfig {
|
|
170
|
+
template: string;
|
|
171
|
+
type: 'vue' | 'html' | 'svelte';
|
|
172
|
+
data: any;
|
|
173
|
+
}
|
|
174
|
+
export interface Md2xBaseOptions {
|
|
175
|
+
theme?: string;
|
|
176
|
+
basePath?: string;
|
|
177
|
+
/** When true, horizontal rules will be converted to page breaks in print/PDF */
|
|
178
|
+
hrAsPageBreak?: boolean;
|
|
179
|
+
/** Diagram/template rendering mode: "img" | "live" | "none" */
|
|
180
|
+
diagramMode?: DiagramMode;
|
|
181
|
+
/** Pre-loaded md2x template sources */
|
|
182
|
+
templates?: Record<string, string>;
|
|
183
|
+
}
|
|
184
|
+
export interface Md2DocxOptions extends Md2xBaseOptions {
|
|
185
|
+
}
|
|
186
|
+
export interface Md2PdfOptions extends Md2xBaseOptions {
|
|
187
|
+
pdf?: PdfOptions;
|
|
188
|
+
/** CDN overrides for live mode */
|
|
189
|
+
cdn?: Md2HtmlOptions['cdn'];
|
|
190
|
+
}
|
|
191
|
+
export interface Md2ImageOptions extends Md2xBaseOptions {
|
|
192
|
+
image?: ImageOptions;
|
|
193
|
+
/** CDN overrides for live diagram mode */
|
|
194
|
+
cdn?: Md2HtmlOptions['cdn'];
|
|
195
|
+
}
|
|
196
|
+
export interface Md2HtmlOptions extends Md2xBaseOptions {
|
|
197
|
+
/** Document title for standalone HTML output */
|
|
198
|
+
title?: string;
|
|
199
|
+
/** When true, returns a full HTML document with embedded CSS (default: true) */
|
|
200
|
+
standalone?: boolean;
|
|
201
|
+
/** Live diagram runtime injection strategy: "inline" | "cdn" */
|
|
202
|
+
liveRuntime?: 'inline' | 'cdn';
|
|
203
|
+
/** Custom runtime base URL when `liveRuntime: "cdn"` */
|
|
204
|
+
liveRuntimeBaseUrl?: string;
|
|
205
|
+
/** Optional CDN overrides */
|
|
206
|
+
cdn?: Partial<{
|
|
207
|
+
mermaid: string;
|
|
208
|
+
vue: string;
|
|
209
|
+
vueSfcLoader: string;
|
|
210
|
+
svelteCompiler: string;
|
|
211
|
+
svelteBase: string;
|
|
212
|
+
}>;
|
|
213
|
+
/** When true, emit a `<base href="file://.../">` tag (default: true) */
|
|
214
|
+
baseTag?: boolean;
|
|
215
|
+
}
|
|
216
|
+
export type NodePlatformOutput = {
|
|
217
|
+
kind: 'buffer';
|
|
218
|
+
} | {
|
|
219
|
+
kind: 'file';
|
|
220
|
+
};
|
|
221
|
+
export interface CreateNodePlatformOptions {
|
|
222
|
+
/** Directory of the running Node module */
|
|
223
|
+
moduleDir: string;
|
|
224
|
+
selectedThemeId: string;
|
|
225
|
+
output: NodePlatformOutput;
|
|
226
|
+
/** Settings to pass to exporters via storage */
|
|
227
|
+
settings?: {
|
|
228
|
+
docxHrAsPageBreak?: boolean;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
export interface CreatedNodePlatform {
|
|
232
|
+
platform: import('../../../src/types/index').PlatformAPI;
|
|
233
|
+
getCapturedBuffer: () => Buffer | null;
|
|
234
|
+
}
|
|
235
|
+
/** Alias for FrontMatterOptions, used as conversion options */
|
|
236
|
+
export type ConvertOptions = FrontMatterOptions & {
|
|
237
|
+
basePath?: string;
|
|
238
|
+
/** Skip front matter parsing (use when markdown is already stripped of front matter) */
|
|
239
|
+
skipFrontMatter?: boolean;
|
|
240
|
+
};
|
|
241
|
+
export interface ConvertResult {
|
|
242
|
+
/** Output buffer */
|
|
243
|
+
buffer: Buffer;
|
|
244
|
+
/** Resolved output path */
|
|
245
|
+
outputPath: string;
|
|
246
|
+
/** Multiple parts for image format with splitting enabled */
|
|
247
|
+
buffers?: Buffer[];
|
|
248
|
+
outputPaths?: string[];
|
|
249
|
+
/** Output format used */
|
|
250
|
+
format: OutputFormat;
|
|
251
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { NodeDocxExporter, NodeHtmlExporter, NodePdfExporter, NodeImageExporter } from './host/node-exporter';
|
|
2
|
-
export type {
|
|
3
|
-
export
|
|
4
|
-
export { type OutputFormat, type DiagramMode, type FrontMatterOptions, type ConvertOptions, type ConvertResult, parseFrontMatter, frontMatterToOptions, markdownToDocxBuffer, markdownToPdfBuffer, markdownToHtmlString, markdownToHtmlBuffer, markdownToImageBuffer, markdownToImageBuffers, convert, convertFile, } from './host/index';
|
|
2
|
+
export type { OutputFormat, DiagramMode, FrontMatterData, FrontMatterOptions, ImageOptions, PdfOptions, MarkdownToHtmlStringOptions, CdnOptions, ConvertOptions, ConvertResult, Md2xTemplateConfig, Md2xBaseOptions, Md2DocxOptions, Md2PdfOptions, Md2ImageOptions, Md2HtmlOptions, RenderResult, BrowserRenderer, NodePlatformOutput, CreateNodePlatformOptions, CreatedNodePlatform, } from './host/types';
|
|
3
|
+
export { parseFrontMatter, frontMatterToOptions, markdownToHtml, markdownToStandaloneHtml, markdownToDocxBuffer, markdownToPdfBuffer, markdownToHtmlString, markdownToHtmlBuffer, markdownToImageBuffer, markdownToImageBuffers, convert, convertFile, } from './host/index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "md2x",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "Markdown converter (local, no server). Supports Mermaid/Graphviz/Vega/HTML/SVG rendering, math, and code highlighting.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -16,13 +16,21 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./core-worker": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/core-worker.js"
|
|
23
|
+
},
|
|
24
|
+
"./core-worker-browser": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/renderer/core-worker-browser.js"
|
|
19
27
|
}
|
|
20
28
|
},
|
|
21
29
|
"scripts": {
|
|
22
30
|
"build": "node build.mjs",
|
|
23
31
|
"dev": "node build.mjs --watch --run",
|
|
24
32
|
"cli": "node dist/md2x.js",
|
|
25
|
-
"test": "node --test test/*.test.mjs",
|
|
33
|
+
"test": "node --test test/*.test.mjs && node test/scripts/cleanup-out.mjs",
|
|
26
34
|
"prepublishOnly": "node build.mjs"
|
|
27
35
|
},
|
|
28
36
|
"keywords": [
|
|
@@ -48,8 +56,10 @@
|
|
|
48
56
|
"node": ">=18"
|
|
49
57
|
},
|
|
50
58
|
"dependencies": {
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
51
60
|
"js-yaml": "^4.1.1",
|
|
52
|
-
"puppeteer": "24.35.0"
|
|
61
|
+
"puppeteer": "24.35.0",
|
|
62
|
+
"zod": "^4.3.6"
|
|
53
63
|
},
|
|
54
64
|
"devDependencies": {
|
|
55
65
|
"@types/js-yaml": "^4.0.9"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as I}from"./chunk-MHCTK6WW.js";import{b as R,d as Y}from"./chunk-NM6J3ND7.js";var k=R((Q,F)=>{"use strict";var m=Object.prototype.hasOwnProperty,D=Object.prototype.toString,T=Object.defineProperty,C=Object.getOwnPropertyDescriptor,S=function(e){return typeof Array.isArray=="function"?Array.isArray(e):D.call(e)==="[object Array]"},j=function(e){if(!e||D.call(e)!=="[object Object]")return!1;var t=m.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&m.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!t&&!r)return!1;var i;for(i in e);return typeof i>"u"||m.call(e,i)},V=function(e,t){T&&t.name==="__proto__"?T(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},_=function(e,t){if(t==="__proto__")if(m.call(e,t)){if(C)return C(e,t).value}else return;return e[t]};F.exports=function n(){var e,t,r,i,a,c,o=arguments[0],p=1,s=arguments.length,f=!1;for(typeof o=="boolean"&&(f=o,o=arguments[1]||{},p=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});p<s;++p)if(e=arguments[p],e!=null)for(t in e)r=_(o,t),i=_(e,t),o!==i&&(f&&i&&(j(i)||(a=S(i)))?(a?(a=!1,c=r&&S(r)?r:[]):c=r&&j(r)?r:{},V(o,{name:t,newValue:n(f,c,i)})):typeof i<"u"&&V(o,{name:t,newValue:i}));return o}});function b(n){if(n)throw n}var g=Y(k(),1);function d(n){if(typeof n!="object"||n===null)return!1;let e=Object.getPrototypeOf(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function x(){let n=[],e={run:t,use:r};return e;function t(...i){let a=-1,c=i.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);o(null,...i);function o(p,...s){let f=n[++a],u=-1;if(p){c(p);return}for(;++u<i.length;)(s[u]===null||s[u]===void 0)&&(s[u]=i[u]);i=s,f?L(f,o)(...s):c(null,...s)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return n.push(i),e}}function L(n,e){let t;return r;function r(...c){let o=n.length>c.length,p;o&&c.push(i);try{p=n.apply(this,c)}catch(s){let f=s;if(o&&t)throw f;return i(f)}o||(p&&p.then&&typeof p.then=="function"?p.then(a,i):p instanceof Error?i(p):a(p))}function i(c,...o){t||(t=!0,e(c,...o))}function a(c){i(null,c)}}var N=(function(n){let r=this.constructor.prototype,i=r[n],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a});var q={}.hasOwnProperty,z=class n extends N{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=x()}copy(){let e=new n,t=-1;for(;++t<this.attachers.length;){let r=this.attachers[t];e.use(...r)}return e.data((0,g.default)(!0,{},this.namespace)),e}data(e,t){return typeof e=="string"?arguments.length===2?(E("data",this.frozen),this.namespace[e]=t,this):q.call(this.namespace,e)&&this.namespace[e]||void 0:e?(E("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);let i=t.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();let t=w(e),r=this.parser||this.Parser;return P("parse",r),r(String(t),t)}process(e,t){let r=this;return this.freeze(),P("process",this.parser||this.Parser),O("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(a,c){let o=w(e),p=r.parse(o);r.run(p,o,function(f,u,l){if(f||!u||!l)return s(f);let h=u,y=r.stringify(h,l);J(y)?l.value=y:l.result=y,s(f,l)});function s(f,u){f||!u?c(f):a?a(u):t(void 0,u)}}}processSync(e){let t=!1,r;return this.freeze(),P("processSync",this.parser||this.Parser),O("processSync",this.compiler||this.Compiler),this.process(e,i),B("processSync","process",t),r;function i(a,c){t=!0,b(a),r=c}}run(e,t,r){U(e),this.freeze();let i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?a(void 0,r):new Promise(a);function a(c,o){let p=w(t);i.run(e,p,s);function s(f,u,l){let h=u||e;f?o(f):c?c(h):r(void 0,h,l)}}}runSync(e,t){let r=!1,i;return this.run(e,t,a),B("runSync","run",r),i;function a(c,o){b(c),i=o,r=!0}}stringify(e,t){this.freeze();let r=w(t),i=this.compiler||this.Compiler;return O("stringify",i),U(e),i(e,r)}use(e,...t){let r=this.attachers,i=this.namespace;if(E("use",this.frozen),e!=null)if(typeof e=="function")p(e,t);else if(typeof e=="object")Array.isArray(e)?o(e):c(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function a(s){if(typeof s=="function")p(s,[]);else if(typeof s=="object")if(Array.isArray(s)){let[f,...u]=s;p(f,u)}else c(s);else throw new TypeError("Expected usable value, not `"+s+"`")}function c(s){if(!("plugins"in s)&&!("settings"in s))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(s.plugins),s.settings&&(i.settings=(0,g.default)(!0,i.settings,s.settings))}function o(s){let f=-1;if(s!=null)if(Array.isArray(s))for(;++f<s.length;){let u=s[f];a(u)}else throw new TypeError("Expected a list of plugins, not `"+s+"`")}function p(s,f){let u=-1,l=-1;for(;++u<r.length;)if(r[u][0]===s){l=u;break}if(l===-1)r.push([s,...f]);else if(f.length>0){let[h,...y]=f,A=r[l][1];d(A)&&d(h)&&(h=(0,g.default)(!0,A,h)),r[l]=[s,h,...y]}}}},G=new z().freeze();function P(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function O(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function E(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function U(n){if(!d(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function B(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function w(n){return H(n)?n:new I(n)}function H(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function J(n){return typeof n=="string"||K(n)}function K(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}export{G as a};
|