@franken-suite/franken-markdown 0.4.2 → 0.4.4

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.
@@ -21,7 +21,7 @@ export class FmdRenderResult {
21
21
  */
22
22
  readonly extension: string;
23
23
  /**
24
- * Stable output format: `html` or `pdf`.
24
+ * Stable output format (`html`, `pdf`, `svg`, `epub`, `zip`, or `diff-html`).
25
25
  */
26
26
  readonly format: string;
27
27
  /**
@@ -34,11 +34,40 @@ export class FmdRenderResult {
34
34
  readonly sourceLength: number;
35
35
  }
36
36
 
37
+ /**
38
+ * Run the exact PDF verification pipeline and keep only authoring-time
39
+ * accessibility findings.
40
+ */
41
+ export function accessibilityAudit(markdown: string): string;
42
+
37
43
  /**
38
44
  * Dependency-free capability contract as JSON.
39
45
  */
40
46
  export function capabilities(): string;
41
47
 
48
+ /**
49
+ * Compute the engine's document intelligence, readability, outline, and
50
+ * structural-lint report without rendering a second time in the host.
51
+ */
52
+ export function documentStats(markdown: string): string;
53
+
54
+ /**
55
+ * Compile in-memory Markdown files into one continuous, bookmarked PDF book.
56
+ */
57
+ export function renderBookPdf(paths: string[], sources: string[], title: string | null | undefined, author: string | null | undefined, font: string | null | undefined, dark_mode: string | null | undefined, font_scale: number | null | undefined, page_numbers: boolean): FmdRenderResult;
58
+
59
+ /**
60
+ * Compile in-memory Markdown files into a deterministic, zero-JavaScript HTML
61
+ * site ZIP. The host owns file selection; the core owns include expansion,
62
+ * link rewriting, navigation, parsing, rendering, and the search index.
63
+ */
64
+ export function renderBookSite(paths: string[], sources: string[], title?: string | null, font?: string | null, dark_mode?: string | null, font_scale?: number | null): FmdRenderResult;
65
+
66
+ /**
67
+ * Render an EPUB 3 e-book through the same parser and HTML theme model.
68
+ */
69
+ export function renderEpubConfigured(markdown: string, font?: string | null, dark_mode?: string | null, title?: string | null, lang?: string | null, font_scale?: number | null): FmdRenderResult;
70
+
42
71
  /**
43
72
  * Render Markdown to self-contained HTML using default browser-safe options.
44
73
  *
@@ -55,6 +84,22 @@ export function renderHtml(markdown: string): FmdRenderResult;
55
84
  */
56
85
  export function renderHtmlConfigured(markdown: string, font: string | null | undefined, dark_mode: string | null | undefined, title: string | null | undefined, custom_css: string | null | undefined, allow_raw_html: boolean): FmdRenderResult;
57
86
 
87
+ /**
88
+ * Render Markdown to self-contained HTML with the complete browser option
89
+ * set, including the core-owned uniform typographic scale.
90
+ *
91
+ * This additive entry point keeps the original narrow ABI stable while giving
92
+ * the ergonomic JavaScript wrapper one canonical path for fonts, images, and
93
+ * type scale. The scale is interpreted by [`WasmRenderOptions`] and therefore
94
+ * changes the Rust-generated theme rather than patching the returned HTML.
95
+ *
96
+ * # Errors
97
+ * Returns a JavaScript error when parallel image arrays are inconsistent, a
98
+ * font asset is invalid, the scale is not positive and finite, or rendering
99
+ * fails.
100
+ */
101
+ export function renderHtmlConfiguredAdvanced(markdown: string, font: string | null | undefined, dark_mode: string | null | undefined, title: string | null | undefined, custom_css: string | null | undefined, allow_raw_html: boolean, font_scale: number | null | undefined, body_regular: Uint8Array, body_bold: Uint8Array, body_italic: Uint8Array, body_bold_italic: Uint8Array, mono_regular: Uint8Array, font_weights: Uint32Array, image_destinations: string[], image_bytes_flat: Uint8Array, image_bytes_lengths: Uint32Array, lang: string | null | undefined, toc: boolean, toc_depth?: number | null): FmdRenderResult;
102
+
58
103
  /**
59
104
  * Render Markdown to self-contained HTML with fonts and any number of host
60
105
  * image assets (data-URI inlined). Parallel image arrays match the PDF multi
@@ -77,6 +122,12 @@ export function renderHtmlConfiguredMulti(markdown: string, font: string | null
77
122
  */
78
123
  export function renderHtmlConfiguredWithFonts(markdown: string, font: string | null | undefined, dark_mode: string | null | undefined, title: string | null | undefined, custom_css: string | null | undefined, allow_raw_html: boolean, body_regular: Uint8Array, body_bold: Uint8Array, body_italic: Uint8Array, body_bold_italic: Uint8Array, mono_regular: Uint8Array, font_weights: Uint32Array): FmdRenderResult;
79
124
 
125
+ /**
126
+ * Render a self-hosting, single-file HTML workspace with its own editor,
127
+ * preview, intelligence panel, and print/PDF path.
128
+ */
129
+ export function renderInteractiveHtmlConfigured(markdown: string, font?: string | null, dark_mode?: string | null, title?: string | null, lang?: string | null, font_scale?: number | null): FmdRenderResult;
130
+
80
131
  /**
81
132
  * Render Markdown to PDF using default browser-safe options.
82
133
  *
@@ -108,7 +159,7 @@ export function renderPdfConfigured(markdown: string, font: string | null | unde
108
159
  * Returns a JavaScript error when the image arrays are inconsistent, an option
109
160
  * is invalid, or rendering fails.
110
161
  */
111
- export function renderPdfConfiguredMulti(markdown: string, font: string | null | undefined, dark_mode: string | null | undefined, title: string | null | undefined, author: string | null | undefined, metadata_epoch_seconds: number | null | undefined, allow_raw_html: boolean, code_line_numbers: boolean, image_destinations: string[], image_bytes_flat: Uint8Array, image_bytes_lengths: Uint32Array, body_regular: Uint8Array, body_bold: Uint8Array, body_italic: Uint8Array, body_bold_italic: Uint8Array, mono_regular: Uint8Array, font_weights: Uint32Array, base_font_size: number | null | undefined, heading_scale: number | null | undefined, table_font_size: number | null | undefined, page_numbers: boolean): FmdRenderResult;
162
+ export function renderPdfConfiguredMulti(markdown: string, font: string | null | undefined, dark_mode: string | null | undefined, title: string | null | undefined, author: string | null | undefined, metadata_epoch_seconds: number | null | undefined, allow_raw_html: boolean, code_line_numbers: boolean, image_destinations: string[], image_bytes_flat: Uint8Array, image_bytes_lengths: Uint32Array, body_regular: Uint8Array, body_bold: Uint8Array, body_italic: Uint8Array, body_bold_italic: Uint8Array, mono_regular: Uint8Array, font_weights: Uint32Array, base_font_size: number | null | undefined, heading_scale: number | null | undefined, table_font_size: number | null | undefined, page_numbers: boolean, font_scale: number | null | undefined, lang: string | null | undefined, toc: boolean, toc_depth: number | null | undefined, fit_to_pages: number | null | undefined, microtype_protrusion: boolean): FmdRenderResult;
112
163
 
113
164
  /**
114
165
  * Render Markdown to PDF with browser package options, one optional image
@@ -134,27 +185,58 @@ export function renderPdfConfiguredWithAssets(markdown: string, font: string | n
134
185
  */
135
186
  export function renderPdfConfiguredWithImage(markdown: string, font: string | null | undefined, dark_mode: string | null | undefined, title: string | null | undefined, author: string | null | undefined, metadata_epoch_seconds: number | null | undefined, allow_raw_html: boolean, code_line_numbers: boolean, image_destination: string, image_bytes: Uint8Array): FmdRenderResult;
136
187
 
188
+ /**
189
+ * Render a semantic AST diff as a self-contained visual HTML document.
190
+ */
191
+ export function renderSemanticDiffHtml(old_markdown: string, new_markdown: string, old_name?: string | null, new_name?: string | null): FmdRenderResult;
192
+
193
+ /**
194
+ * Render a standalone vector poster with glyph outlines embedded as paths.
195
+ */
196
+ export function renderSvgConfigured(markdown: string, font?: string | null, dark_mode?: string | null, font_scale?: number | null, max_width_pt?: number | null): FmdRenderResult;
197
+
198
+ /**
199
+ * Build the deterministic search index used by static-document experiences.
200
+ */
201
+ export function searchIndex(markdown: string): string;
202
+
203
+ /**
204
+ * Compute a semantic AST diff and return its stable JSON contract.
205
+ */
206
+ export function semanticDiff(old_markdown: string, new_markdown: string, old_name?: string | null, new_name?: string | null): string;
207
+
137
208
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
138
209
 
139
210
  export interface InitOutput {
140
211
  readonly memory: WebAssembly.Memory;
141
212
  readonly __wbg_fmdrenderresult_free: (a: number, b: number) => void;
213
+ readonly accessibilityAudit: (a: number, b: number, c: number) => void;
142
214
  readonly capabilities: (a: number) => void;
215
+ readonly documentStats: (a: number, b: number, c: number) => void;
143
216
  readonly fmdrenderresult_bytes: (a: number, b: number) => void;
144
217
  readonly fmdrenderresult_diagnosticsJson: (a: number, b: number) => void;
145
218
  readonly fmdrenderresult_extension: (a: number, b: number) => void;
146
219
  readonly fmdrenderresult_format: (a: number, b: number) => void;
147
220
  readonly fmdrenderresult_mimeType: (a: number, b: number) => void;
148
221
  readonly fmdrenderresult_sourceLength: (a: number) => number;
222
+ readonly renderBookPdf: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
223
+ readonly renderBookSite: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
224
+ readonly renderEpubConfigured: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
149
225
  readonly renderHtml: (a: number, b: number, c: number) => void;
150
226
  readonly renderHtmlConfigured: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
227
+ readonly renderHtmlConfiguredAdvanced: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number) => void;
151
228
  readonly renderHtmlConfiguredMulti: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number) => void;
152
229
  readonly renderHtmlConfiguredWithFonts: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number) => void;
230
+ readonly renderInteractiveHtmlConfigured: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
153
231
  readonly renderPdf: (a: number, b: number, c: number) => void;
154
232
  readonly renderPdfConfigured: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
155
- readonly renderPdfConfiguredMulti: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number, k1: number, l1: number, m1: number, n1: number) => void;
233
+ readonly renderPdfConfiguredMulti: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number, k1: number, l1: number, m1: number, n1: number, o1: number, p1: number, q1: number, r1: number, s1: number, t1: number, u1: number, v1: number) => void;
156
234
  readonly renderPdfConfiguredWithAssets: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number) => void;
157
235
  readonly renderPdfConfiguredWithImage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number) => void;
236
+ readonly renderSemanticDiffHtml: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
237
+ readonly renderSvgConfigured: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
238
+ readonly searchIndex: (a: number, b: number, c: number) => void;
239
+ readonly semanticDiff: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
158
240
  readonly __wbindgen_export: (a: number, b: number) => number;
159
241
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
160
242
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
@@ -78,7 +78,7 @@ export class FmdRenderResult {
78
78
  }
79
79
  }
80
80
  /**
81
- * Stable output format: `html` or `pdf`.
81
+ * Stable output format (`html`, `pdf`, `svg`, `epub`, `zip`, or `diff-html`).
82
82
  * @returns {string}
83
83
  */
84
84
  get format() {
@@ -128,6 +128,39 @@ export class FmdRenderResult {
128
128
  }
129
129
  if (Symbol.dispose) FmdRenderResult.prototype[Symbol.dispose] = FmdRenderResult.prototype.free;
130
130
 
131
+ /**
132
+ * Run the exact PDF verification pipeline and keep only authoring-time
133
+ * accessibility findings.
134
+ * @param {string} markdown
135
+ * @returns {string}
136
+ */
137
+ export function accessibilityAudit(markdown) {
138
+ let deferred3_0;
139
+ let deferred3_1;
140
+ try {
141
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
142
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
143
+ const len0 = WASM_VECTOR_LEN;
144
+ wasm.accessibilityAudit(retptr, ptr0, len0);
145
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
146
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
147
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
148
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
149
+ var ptr2 = r0;
150
+ var len2 = r1;
151
+ if (r3) {
152
+ ptr2 = 0; len2 = 0;
153
+ throw takeObject(r2);
154
+ }
155
+ deferred3_0 = ptr2;
156
+ deferred3_1 = len2;
157
+ return getStringFromWasm0(ptr2, len2);
158
+ } finally {
159
+ wasm.__wbindgen_add_to_stack_pointer(16);
160
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
161
+ }
162
+ }
163
+
131
164
  /**
132
165
  * Dependency-free capability contract as JSON.
133
166
  * @returns {string}
@@ -149,6 +182,145 @@ export function capabilities() {
149
182
  }
150
183
  }
151
184
 
185
+ /**
186
+ * Compute the engine's document intelligence, readability, outline, and
187
+ * structural-lint report without rendering a second time in the host.
188
+ * @param {string} markdown
189
+ * @returns {string}
190
+ */
191
+ export function documentStats(markdown) {
192
+ let deferred2_0;
193
+ let deferred2_1;
194
+ try {
195
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
196
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
197
+ const len0 = WASM_VECTOR_LEN;
198
+ wasm.documentStats(retptr, ptr0, len0);
199
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
200
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
201
+ deferred2_0 = r0;
202
+ deferred2_1 = r1;
203
+ return getStringFromWasm0(r0, r1);
204
+ } finally {
205
+ wasm.__wbindgen_add_to_stack_pointer(16);
206
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Compile in-memory Markdown files into one continuous, bookmarked PDF book.
212
+ * @param {string[]} paths
213
+ * @param {string[]} sources
214
+ * @param {string | null | undefined} title
215
+ * @param {string | null | undefined} author
216
+ * @param {string | null | undefined} font
217
+ * @param {string | null | undefined} dark_mode
218
+ * @param {number | null | undefined} font_scale
219
+ * @param {boolean} page_numbers
220
+ * @returns {FmdRenderResult}
221
+ */
222
+ export function renderBookPdf(paths, sources, title, author, font, dark_mode, font_scale, page_numbers) {
223
+ try {
224
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
225
+ const ptr0 = passArrayJsValueToWasm0(paths, wasm.__wbindgen_export);
226
+ const len0 = WASM_VECTOR_LEN;
227
+ const ptr1 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export);
228
+ const len1 = WASM_VECTOR_LEN;
229
+ var ptr2 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
230
+ var len2 = WASM_VECTOR_LEN;
231
+ var ptr3 = isLikeNone(author) ? 0 : passStringToWasm0(author, wasm.__wbindgen_export, wasm.__wbindgen_export2);
232
+ var len3 = WASM_VECTOR_LEN;
233
+ var ptr4 = isLikeNone(font) ? 0 : passStringToWasm0(font, wasm.__wbindgen_export, wasm.__wbindgen_export2);
234
+ var len4 = WASM_VECTOR_LEN;
235
+ var ptr5 = isLikeNone(dark_mode) ? 0 : passStringToWasm0(dark_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
236
+ var len5 = WASM_VECTOR_LEN;
237
+ wasm.renderBookPdf(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, !isLikeNone(font_scale), isLikeNone(font_scale) ? 0 : font_scale, page_numbers);
238
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
239
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
240
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
241
+ if (r2) {
242
+ throw takeObject(r1);
243
+ }
244
+ return FmdRenderResult.__wrap(r0);
245
+ } finally {
246
+ wasm.__wbindgen_add_to_stack_pointer(16);
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Compile in-memory Markdown files into a deterministic, zero-JavaScript HTML
252
+ * site ZIP. The host owns file selection; the core owns include expansion,
253
+ * link rewriting, navigation, parsing, rendering, and the search index.
254
+ * @param {string[]} paths
255
+ * @param {string[]} sources
256
+ * @param {string | null} [title]
257
+ * @param {string | null} [font]
258
+ * @param {string | null} [dark_mode]
259
+ * @param {number | null} [font_scale]
260
+ * @returns {FmdRenderResult}
261
+ */
262
+ export function renderBookSite(paths, sources, title, font, dark_mode, font_scale) {
263
+ try {
264
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
265
+ const ptr0 = passArrayJsValueToWasm0(paths, wasm.__wbindgen_export);
266
+ const len0 = WASM_VECTOR_LEN;
267
+ const ptr1 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export);
268
+ const len1 = WASM_VECTOR_LEN;
269
+ var ptr2 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
270
+ var len2 = WASM_VECTOR_LEN;
271
+ var ptr3 = isLikeNone(font) ? 0 : passStringToWasm0(font, wasm.__wbindgen_export, wasm.__wbindgen_export2);
272
+ var len3 = WASM_VECTOR_LEN;
273
+ var ptr4 = isLikeNone(dark_mode) ? 0 : passStringToWasm0(dark_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
274
+ var len4 = WASM_VECTOR_LEN;
275
+ wasm.renderBookSite(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(font_scale), isLikeNone(font_scale) ? 0 : font_scale);
276
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
277
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
278
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
279
+ if (r2) {
280
+ throw takeObject(r1);
281
+ }
282
+ return FmdRenderResult.__wrap(r0);
283
+ } finally {
284
+ wasm.__wbindgen_add_to_stack_pointer(16);
285
+ }
286
+ }
287
+
288
+ /**
289
+ * Render an EPUB 3 e-book through the same parser and HTML theme model.
290
+ * @param {string} markdown
291
+ * @param {string | null} [font]
292
+ * @param {string | null} [dark_mode]
293
+ * @param {string | null} [title]
294
+ * @param {string | null} [lang]
295
+ * @param {number | null} [font_scale]
296
+ * @returns {FmdRenderResult}
297
+ */
298
+ export function renderEpubConfigured(markdown, font, dark_mode, title, lang, font_scale) {
299
+ try {
300
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
301
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
302
+ const len0 = WASM_VECTOR_LEN;
303
+ var ptr1 = isLikeNone(font) ? 0 : passStringToWasm0(font, wasm.__wbindgen_export, wasm.__wbindgen_export2);
304
+ var len1 = WASM_VECTOR_LEN;
305
+ var ptr2 = isLikeNone(dark_mode) ? 0 : passStringToWasm0(dark_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
306
+ var len2 = WASM_VECTOR_LEN;
307
+ var ptr3 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
308
+ var len3 = WASM_VECTOR_LEN;
309
+ var ptr4 = isLikeNone(lang) ? 0 : passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
310
+ var len4 = WASM_VECTOR_LEN;
311
+ wasm.renderEpubConfigured(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(font_scale), isLikeNone(font_scale) ? 0 : font_scale);
312
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
313
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
314
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
315
+ if (r2) {
316
+ throw takeObject(r1);
317
+ }
318
+ return FmdRenderResult.__wrap(r0);
319
+ } finally {
320
+ wasm.__wbindgen_add_to_stack_pointer(16);
321
+ }
322
+ }
323
+
152
324
  /**
153
325
  * Render Markdown to self-contained HTML using default browser-safe options.
154
326
  *
@@ -214,6 +386,86 @@ export function renderHtmlConfigured(markdown, font, dark_mode, title, custom_cs
214
386
  }
215
387
  }
216
388
 
389
+ /**
390
+ * Render Markdown to self-contained HTML with the complete browser option
391
+ * set, including the core-owned uniform typographic scale.
392
+ *
393
+ * This additive entry point keeps the original narrow ABI stable while giving
394
+ * the ergonomic JavaScript wrapper one canonical path for fonts, images, and
395
+ * type scale. The scale is interpreted by [`WasmRenderOptions`] and therefore
396
+ * changes the Rust-generated theme rather than patching the returned HTML.
397
+ *
398
+ * # Errors
399
+ * Returns a JavaScript error when parallel image arrays are inconsistent, a
400
+ * font asset is invalid, the scale is not positive and finite, or rendering
401
+ * fails.
402
+ * @param {string} markdown
403
+ * @param {string | null | undefined} font
404
+ * @param {string | null | undefined} dark_mode
405
+ * @param {string | null | undefined} title
406
+ * @param {string | null | undefined} custom_css
407
+ * @param {boolean} allow_raw_html
408
+ * @param {number | null | undefined} font_scale
409
+ * @param {Uint8Array} body_regular
410
+ * @param {Uint8Array} body_bold
411
+ * @param {Uint8Array} body_italic
412
+ * @param {Uint8Array} body_bold_italic
413
+ * @param {Uint8Array} mono_regular
414
+ * @param {Uint32Array} font_weights
415
+ * @param {string[]} image_destinations
416
+ * @param {Uint8Array} image_bytes_flat
417
+ * @param {Uint32Array} image_bytes_lengths
418
+ * @param {string | null | undefined} lang
419
+ * @param {boolean} toc
420
+ * @param {number | null} [toc_depth]
421
+ * @returns {FmdRenderResult}
422
+ */
423
+ export function renderHtmlConfiguredAdvanced(markdown, font, dark_mode, title, custom_css, allow_raw_html, font_scale, body_regular, body_bold, body_italic, body_bold_italic, mono_regular, font_weights, image_destinations, image_bytes_flat, image_bytes_lengths, lang, toc, toc_depth) {
424
+ try {
425
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
426
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
427
+ const len0 = WASM_VECTOR_LEN;
428
+ var ptr1 = isLikeNone(font) ? 0 : passStringToWasm0(font, wasm.__wbindgen_export, wasm.__wbindgen_export2);
429
+ var len1 = WASM_VECTOR_LEN;
430
+ var ptr2 = isLikeNone(dark_mode) ? 0 : passStringToWasm0(dark_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
431
+ var len2 = WASM_VECTOR_LEN;
432
+ var ptr3 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
433
+ var len3 = WASM_VECTOR_LEN;
434
+ var ptr4 = isLikeNone(custom_css) ? 0 : passStringToWasm0(custom_css, wasm.__wbindgen_export, wasm.__wbindgen_export2);
435
+ var len4 = WASM_VECTOR_LEN;
436
+ const ptr5 = passArray8ToWasm0(body_regular, wasm.__wbindgen_export);
437
+ const len5 = WASM_VECTOR_LEN;
438
+ const ptr6 = passArray8ToWasm0(body_bold, wasm.__wbindgen_export);
439
+ const len6 = WASM_VECTOR_LEN;
440
+ const ptr7 = passArray8ToWasm0(body_italic, wasm.__wbindgen_export);
441
+ const len7 = WASM_VECTOR_LEN;
442
+ const ptr8 = passArray8ToWasm0(body_bold_italic, wasm.__wbindgen_export);
443
+ const len8 = WASM_VECTOR_LEN;
444
+ const ptr9 = passArray8ToWasm0(mono_regular, wasm.__wbindgen_export);
445
+ const len9 = WASM_VECTOR_LEN;
446
+ const ptr10 = passArray32ToWasm0(font_weights, wasm.__wbindgen_export);
447
+ const len10 = WASM_VECTOR_LEN;
448
+ const ptr11 = passArrayJsValueToWasm0(image_destinations, wasm.__wbindgen_export);
449
+ const len11 = WASM_VECTOR_LEN;
450
+ const ptr12 = passArray8ToWasm0(image_bytes_flat, wasm.__wbindgen_export);
451
+ const len12 = WASM_VECTOR_LEN;
452
+ const ptr13 = passArray32ToWasm0(image_bytes_lengths, wasm.__wbindgen_export);
453
+ const len13 = WASM_VECTOR_LEN;
454
+ var ptr14 = isLikeNone(lang) ? 0 : passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
455
+ var len14 = WASM_VECTOR_LEN;
456
+ wasm.renderHtmlConfiguredAdvanced(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, allow_raw_html, !isLikeNone(font_scale), isLikeNone(font_scale) ? 0 : font_scale, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, ptr14, len14, toc, isLikeNone(toc_depth) ? Number.MAX_SAFE_INTEGER : (toc_depth) >>> 0);
457
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
458
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
459
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
460
+ if (r2) {
461
+ throw takeObject(r1);
462
+ }
463
+ return FmdRenderResult.__wrap(r0);
464
+ } finally {
465
+ wasm.__wbindgen_add_to_stack_pointer(16);
466
+ }
467
+ }
468
+
217
469
  /**
218
470
  * Render Markdown to self-contained HTML with fonts and any number of host
219
471
  * image assets (data-URI inlined). Parallel image arrays match the PDF multi
@@ -343,6 +595,43 @@ export function renderHtmlConfiguredWithFonts(markdown, font, dark_mode, title,
343
595
  }
344
596
  }
345
597
 
598
+ /**
599
+ * Render a self-hosting, single-file HTML workspace with its own editor,
600
+ * preview, intelligence panel, and print/PDF path.
601
+ * @param {string} markdown
602
+ * @param {string | null} [font]
603
+ * @param {string | null} [dark_mode]
604
+ * @param {string | null} [title]
605
+ * @param {string | null} [lang]
606
+ * @param {number | null} [font_scale]
607
+ * @returns {FmdRenderResult}
608
+ */
609
+ export function renderInteractiveHtmlConfigured(markdown, font, dark_mode, title, lang, font_scale) {
610
+ try {
611
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
612
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
613
+ const len0 = WASM_VECTOR_LEN;
614
+ var ptr1 = isLikeNone(font) ? 0 : passStringToWasm0(font, wasm.__wbindgen_export, wasm.__wbindgen_export2);
615
+ var len1 = WASM_VECTOR_LEN;
616
+ var ptr2 = isLikeNone(dark_mode) ? 0 : passStringToWasm0(dark_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
617
+ var len2 = WASM_VECTOR_LEN;
618
+ var ptr3 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
619
+ var len3 = WASM_VECTOR_LEN;
620
+ var ptr4 = isLikeNone(lang) ? 0 : passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
621
+ var len4 = WASM_VECTOR_LEN;
622
+ wasm.renderInteractiveHtmlConfigured(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(font_scale), isLikeNone(font_scale) ? 0 : font_scale);
623
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
624
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
625
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
626
+ if (r2) {
627
+ throw takeObject(r1);
628
+ }
629
+ return FmdRenderResult.__wrap(r0);
630
+ } finally {
631
+ wasm.__wbindgen_add_to_stack_pointer(16);
632
+ }
633
+ }
634
+
346
635
  /**
347
636
  * Render Markdown to PDF using default browser-safe options.
348
637
  *
@@ -445,9 +734,15 @@ export function renderPdfConfigured(markdown, font, dark_mode, title, author, me
445
734
  * @param {number | null | undefined} heading_scale
446
735
  * @param {number | null | undefined} table_font_size
447
736
  * @param {boolean} page_numbers
737
+ * @param {number | null | undefined} font_scale
738
+ * @param {string | null | undefined} lang
739
+ * @param {boolean} toc
740
+ * @param {number | null | undefined} toc_depth
741
+ * @param {number | null | undefined} fit_to_pages
742
+ * @param {boolean} microtype_protrusion
448
743
  * @returns {FmdRenderResult}
449
744
  */
450
- export function renderPdfConfiguredMulti(markdown, font, dark_mode, title, author, metadata_epoch_seconds, allow_raw_html, code_line_numbers, image_destinations, image_bytes_flat, image_bytes_lengths, body_regular, body_bold, body_italic, body_bold_italic, mono_regular, font_weights, base_font_size, heading_scale, table_font_size, page_numbers) {
745
+ export function renderPdfConfiguredMulti(markdown, font, dark_mode, title, author, metadata_epoch_seconds, allow_raw_html, code_line_numbers, image_destinations, image_bytes_flat, image_bytes_lengths, body_regular, body_bold, body_italic, body_bold_italic, mono_regular, font_weights, base_font_size, heading_scale, table_font_size, page_numbers, font_scale, lang, toc, toc_depth, fit_to_pages, microtype_protrusion) {
451
746
  try {
452
747
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
453
748
  const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -478,7 +773,9 @@ export function renderPdfConfiguredMulti(markdown, font, dark_mode, title, autho
478
773
  const len12 = WASM_VECTOR_LEN;
479
774
  const ptr13 = passArray32ToWasm0(font_weights, wasm.__wbindgen_export);
480
775
  const len13 = WASM_VECTOR_LEN;
481
- wasm.renderPdfConfiguredMulti(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(metadata_epoch_seconds), isLikeNone(metadata_epoch_seconds) ? 0 : metadata_epoch_seconds, allow_raw_html, code_line_numbers, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, !isLikeNone(base_font_size), isLikeNone(base_font_size) ? 0 : base_font_size, !isLikeNone(heading_scale), isLikeNone(heading_scale) ? 0 : heading_scale, !isLikeNone(table_font_size), isLikeNone(table_font_size) ? 0 : table_font_size, page_numbers);
776
+ var ptr14 = isLikeNone(lang) ? 0 : passStringToWasm0(lang, wasm.__wbindgen_export, wasm.__wbindgen_export2);
777
+ var len14 = WASM_VECTOR_LEN;
778
+ wasm.renderPdfConfiguredMulti(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, !isLikeNone(metadata_epoch_seconds), isLikeNone(metadata_epoch_seconds) ? 0 : metadata_epoch_seconds, allow_raw_html, code_line_numbers, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8, ptr9, len9, ptr10, len10, ptr11, len11, ptr12, len12, ptr13, len13, !isLikeNone(base_font_size), isLikeNone(base_font_size) ? 0 : base_font_size, !isLikeNone(heading_scale), isLikeNone(heading_scale) ? 0 : heading_scale, !isLikeNone(table_font_size), isLikeNone(table_font_size) ? 0 : table_font_size, page_numbers, !isLikeNone(font_scale), isLikeNone(font_scale) ? 0 : font_scale, ptr14, len14, toc, isLikeNone(toc_depth) ? Number.MAX_SAFE_INTEGER : (toc_depth) >>> 0, isLikeNone(fit_to_pages) ? Number.MAX_SAFE_INTEGER : (fit_to_pages) >>> 0, microtype_protrusion);
482
779
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
483
780
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
484
781
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -607,6 +904,115 @@ export function renderPdfConfiguredWithImage(markdown, font, dark_mode, title, a
607
904
  wasm.__wbindgen_add_to_stack_pointer(16);
608
905
  }
609
906
  }
907
+
908
+ /**
909
+ * Render a semantic AST diff as a self-contained visual HTML document.
910
+ * @param {string} old_markdown
911
+ * @param {string} new_markdown
912
+ * @param {string | null} [old_name]
913
+ * @param {string | null} [new_name]
914
+ * @returns {FmdRenderResult}
915
+ */
916
+ export function renderSemanticDiffHtml(old_markdown, new_markdown, old_name, new_name) {
917
+ const ptr0 = passStringToWasm0(old_markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
918
+ const len0 = WASM_VECTOR_LEN;
919
+ const ptr1 = passStringToWasm0(new_markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
920
+ const len1 = WASM_VECTOR_LEN;
921
+ var ptr2 = isLikeNone(old_name) ? 0 : passStringToWasm0(old_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
922
+ var len2 = WASM_VECTOR_LEN;
923
+ var ptr3 = isLikeNone(new_name) ? 0 : passStringToWasm0(new_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
924
+ var len3 = WASM_VECTOR_LEN;
925
+ const ret = wasm.renderSemanticDiffHtml(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
926
+ return FmdRenderResult.__wrap(ret);
927
+ }
928
+
929
+ /**
930
+ * Render a standalone vector poster with glyph outlines embedded as paths.
931
+ * @param {string} markdown
932
+ * @param {string | null} [font]
933
+ * @param {string | null} [dark_mode]
934
+ * @param {number | null} [font_scale]
935
+ * @param {number | null} [max_width_pt]
936
+ * @returns {FmdRenderResult}
937
+ */
938
+ export function renderSvgConfigured(markdown, font, dark_mode, font_scale, max_width_pt) {
939
+ try {
940
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
941
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
942
+ const len0 = WASM_VECTOR_LEN;
943
+ var ptr1 = isLikeNone(font) ? 0 : passStringToWasm0(font, wasm.__wbindgen_export, wasm.__wbindgen_export2);
944
+ var len1 = WASM_VECTOR_LEN;
945
+ var ptr2 = isLikeNone(dark_mode) ? 0 : passStringToWasm0(dark_mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
946
+ var len2 = WASM_VECTOR_LEN;
947
+ wasm.renderSvgConfigured(retptr, ptr0, len0, ptr1, len1, ptr2, len2, !isLikeNone(font_scale), isLikeNone(font_scale) ? 0 : font_scale, !isLikeNone(max_width_pt), isLikeNone(max_width_pt) ? 0 : max_width_pt);
948
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
949
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
950
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
951
+ if (r2) {
952
+ throw takeObject(r1);
953
+ }
954
+ return FmdRenderResult.__wrap(r0);
955
+ } finally {
956
+ wasm.__wbindgen_add_to_stack_pointer(16);
957
+ }
958
+ }
959
+
960
+ /**
961
+ * Build the deterministic search index used by static-document experiences.
962
+ * @param {string} markdown
963
+ * @returns {string}
964
+ */
965
+ export function searchIndex(markdown) {
966
+ let deferred2_0;
967
+ let deferred2_1;
968
+ try {
969
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
970
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
971
+ const len0 = WASM_VECTOR_LEN;
972
+ wasm.searchIndex(retptr, ptr0, len0);
973
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
974
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
975
+ deferred2_0 = r0;
976
+ deferred2_1 = r1;
977
+ return getStringFromWasm0(r0, r1);
978
+ } finally {
979
+ wasm.__wbindgen_add_to_stack_pointer(16);
980
+ wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
981
+ }
982
+ }
983
+
984
+ /**
985
+ * Compute a semantic AST diff and return its stable JSON contract.
986
+ * @param {string} old_markdown
987
+ * @param {string} new_markdown
988
+ * @param {string | null} [old_name]
989
+ * @param {string | null} [new_name]
990
+ * @returns {string}
991
+ */
992
+ export function semanticDiff(old_markdown, new_markdown, old_name, new_name) {
993
+ let deferred5_0;
994
+ let deferred5_1;
995
+ try {
996
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
997
+ const ptr0 = passStringToWasm0(old_markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
998
+ const len0 = WASM_VECTOR_LEN;
999
+ const ptr1 = passStringToWasm0(new_markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1000
+ const len1 = WASM_VECTOR_LEN;
1001
+ var ptr2 = isLikeNone(old_name) ? 0 : passStringToWasm0(old_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1002
+ var len2 = WASM_VECTOR_LEN;
1003
+ var ptr3 = isLikeNone(new_name) ? 0 : passStringToWasm0(new_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1004
+ var len3 = WASM_VECTOR_LEN;
1005
+ wasm.semanticDiff(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1006
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1007
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1008
+ deferred5_0 = r0;
1009
+ deferred5_1 = r1;
1010
+ return getStringFromWasm0(r0, r1);
1011
+ } finally {
1012
+ wasm.__wbindgen_add_to_stack_pointer(16);
1013
+ wasm.__wbindgen_export3(deferred5_0, deferred5_1, 1);
1014
+ }
1015
+ }
610
1016
  function __wbg_get_imports() {
611
1017
  const import0 = {
612
1018
  __proto__: null,
Binary file