html-to-markdown-wasm 2.8.2 → 2.9.0

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 CHANGED
@@ -15,7 +15,7 @@ Runs anywhere: Node.js, Deno, Bun, browsers, and edge runtimes.
15
15
  [![PyPI](https://badge.fury.io/py/html-to-markdown.svg)](https://pypi.org/project/html-to-markdown/)
16
16
  [![Packagist](https://img.shields.io/packagist/v/goldziher/html-to-markdown.svg)](https://packagist.org/packages/goldziher/html-to-markdown)
17
17
  [![RubyGems](https://badge.fury.io/rb/html-to-markdown.svg)](https://rubygems.org/gems/html-to-markdown)
18
- [![NuGet](https://img.shields.io/nuget/v/HtmlToMarkdown.svg)](https://www.nuget.org/packages/HtmlToMarkdown/)
18
+ [![NuGet](https://img.shields.io/nuget/v/Goldziher.HtmlToMarkdown.svg)](https://www.nuget.org/packages/Goldziher.HtmlToMarkdown/)
19
19
  [![Maven Central](https://img.shields.io/maven-central/v/io.github.goldziher/html-to-markdown.svg)](https://central.sonatype.com/artifact/io.github.goldziher/html-to-markdown)
20
20
  [![Go Reference](https://pkg.go.dev/badge/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown.svg)](https://pkg.go.dev/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown)
21
21
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
package/dist/README.md CHANGED
@@ -9,7 +9,7 @@ High-performance HTML → Markdown conversion powered by Rust. Shipping as a Rus
9
9
  [![Packagist](https://img.shields.io/packagist/v/goldziher/html-to-markdown.svg)](https://packagist.org/packages/goldziher/html-to-markdown)
10
10
  [![RubyGems](https://badge.fury.io/rb/html-to-markdown.svg)](https://rubygems.org/gems/html-to-markdown)
11
11
  [![Hex.pm](https://img.shields.io/hexpm/v/html_to_markdown.svg)](https://hex.pm/packages/html_to_markdown)
12
- [![NuGet](https://img.shields.io/nuget/v/HtmlToMarkdown.svg)](https://www.nuget.org/packages/HtmlToMarkdown/)
12
+ [![NuGet](https://img.shields.io/nuget/v/Goldziher.HtmlToMarkdown.svg)](https://www.nuget.org/packages/Goldziher.HtmlToMarkdown/)
13
13
  [![Maven Central](https://img.shields.io/maven-central/v/io.github.goldziher/html-to-markdown.svg)](https://central.sonatype.com/artifact/io.github.goldziher/html-to-markdown)
14
14
  [![Go Reference](https://pkg.go.dev/badge/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown.svg)](https://pkg.go.dev/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown)
15
15
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
@@ -219,6 +219,20 @@ Need a call-stack view of the Rust core? Run `task flamegraph:rust` (or call the
219
219
 
220
220
  ## Compatibility (v1 → v2)
221
221
 
222
+ ## Testing
223
+
224
+ Use the task runner to execute the entire matrix locally:
225
+
226
+ ```bash
227
+ # All core test suites (Rust, Python, Ruby, Node, PHP, Go, C#, Elixir, Java)
228
+ task test
229
+
230
+ # Run the Wasmtime-backed WASM integration tests
231
+ task wasm:test:wasmtime
232
+ ```
233
+
234
+ The Wasmtime suite builds the `html-to-markdown-wasm` artifact with the same flags used in CI and drives it through Wasmtime to ensure the non-JS runtime behaves exactly like the browser/Deno builds.
235
+
222
236
  - V2’s Rust core sustains **150–210 MB/s** throughput; V1 averaged **≈ 2.5 MB/s** in its Python/BeautifulSoup implementation (60–80× faster).
223
237
  - The Python package offers a compatibility shim in `html_to_markdown.v1_compat` (`convert_to_markdown`, `convert_to_markdown_stream`, `markdownify`). The shim is deprecated, emits `DeprecationWarning` on every call, and will be removed in v3.0—plan migrations now. Details and keyword mappings live in [Python README](https://github.com/Goldziher/html-to-markdown/blob/main/packages/python/README.md#v1-compatibility).
224
238
  - CLI flag changes, option renames, and other breaking updates are summarised in [CHANGELOG](https://github.com/Goldziher/html-to-markdown/blob/main/CHANGELOG.md#breaking-changes).
@@ -1,9 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
4
- export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
5
- export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
6
- export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
3
+ /**
4
+ * Initialize panic hook for better error messages in the browser
5
+ */
6
+ export function init(): void;
7
7
  export function convertBytes(html: Uint8Array, options: any): string;
8
8
  /**
9
9
  * Convert HTML to Markdown
@@ -24,11 +24,11 @@ export function convertBytes(html: Uint8Array, options: any): string;
24
24
  * ```
25
25
  */
26
26
  export function convert(html: string, options: any): string;
27
+ export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
28
+ export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
29
+ export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
27
30
  export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
28
- /**
29
- * Initialize panic hook for better error messages in the browser
30
- */
31
- export function init(): void;
31
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
34
34
  [Symbol.dispose](): void;
@@ -232,71 +232,23 @@ function getArrayJsValueFromWasm0(ptr, len) {
232
232
  return result;
233
233
  }
234
234
  /**
235
- * @param {any} options
236
- * @returns {WasmConversionOptionsHandle}
237
- */
238
- export function createConversionOptionsHandle(options) {
239
- try {
240
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
241
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
242
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
243
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
244
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
245
- if (r2) {
246
- throw takeObject(r1);
247
- }
248
- return WasmConversionOptionsHandle.__wrap(r0);
249
- } finally {
250
- wasm.__wbindgen_add_to_stack_pointer(16);
251
- }
252
- }
253
-
254
- function _assertClass(instance, klass) {
255
- if (!(instance instanceof klass)) {
256
- throw new Error(`expected instance of ${klass.name}`);
257
- }
258
- }
259
- /**
260
- * @param {string} html
261
- * @param {any} options
262
- * @param {WasmInlineImageConfig | null} [image_config]
263
- * @returns {WasmHtmlExtraction}
235
+ * Initialize panic hook for better error messages in the browser
264
236
  */
265
- export function convertWithInlineImages(html, options, image_config) {
266
- try {
267
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
268
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
269
- const len0 = WASM_VECTOR_LEN;
270
- let ptr1 = 0;
271
- if (!isLikeNone(image_config)) {
272
- _assertClass(image_config, WasmInlineImageConfig);
273
- ptr1 = image_config.__destroy_into_raw();
274
- }
275
- wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
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 WasmHtmlExtraction.__wrap(r0);
283
- } finally {
284
- wasm.__wbindgen_add_to_stack_pointer(16);
285
- }
237
+ export function init() {
238
+ wasm.init();
286
239
  }
287
240
 
288
241
  /**
289
242
  * @param {Uint8Array} html
290
- * @param {WasmConversionOptionsHandle} handle
243
+ * @param {any} options
291
244
  * @returns {string}
292
245
  */
293
- export function convertBytesWithOptionsHandle(html, handle) {
246
+ export function convertBytes(html, options) {
294
247
  let deferred2_0;
295
248
  let deferred2_1;
296
249
  try {
297
250
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
298
- _assertClass(handle, WasmConversionOptionsHandle);
299
- wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
251
+ wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
300
252
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
301
253
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
302
254
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -317,19 +269,34 @@ export function convertBytesWithOptionsHandle(html, handle) {
317
269
  }
318
270
 
319
271
  /**
272
+ * Convert HTML to Markdown
273
+ *
274
+ * # Arguments
275
+ *
276
+ * * `html` - The HTML string to convert
277
+ * * `options` - Optional conversion options (as a JavaScript object)
278
+ *
279
+ * # Example
280
+ *
281
+ * ```javascript
282
+ * import { convert } from 'html-to-markdown-wasm';
283
+ *
284
+ * const html = '<h1>Hello World</h1>';
285
+ * const markdown = convert(html);
286
+ * console.log(markdown); // # Hello World
287
+ * ```
320
288
  * @param {string} html
321
- * @param {WasmConversionOptionsHandle} handle
289
+ * @param {any} options
322
290
  * @returns {string}
323
291
  */
324
- export function convertWithOptionsHandle(html, handle) {
292
+ export function convert(html, options) {
325
293
  let deferred3_0;
326
294
  let deferred3_1;
327
295
  try {
328
296
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
329
297
  const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
330
298
  const len0 = WASM_VECTOR_LEN;
331
- _assertClass(handle, WasmConversionOptionsHandle);
332
- wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
299
+ wasm.convert(retptr, ptr0, len0, addHeapObject(options));
333
300
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
334
301
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
335
302
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -349,17 +316,52 @@ export function convertWithOptionsHandle(html, handle) {
349
316
  }
350
317
  }
351
318
 
319
+ function _assertClass(instance, klass) {
320
+ if (!(instance instanceof klass)) {
321
+ throw new Error(`expected instance of ${klass.name}`);
322
+ }
323
+ }
352
324
  /**
353
- * @param {Uint8Array} html
325
+ * @param {string} html
354
326
  * @param {any} options
327
+ * @param {WasmInlineImageConfig | null} [image_config]
328
+ * @returns {WasmHtmlExtraction}
329
+ */
330
+ export function convertWithInlineImages(html, options, image_config) {
331
+ try {
332
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
333
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
334
+ const len0 = WASM_VECTOR_LEN;
335
+ let ptr1 = 0;
336
+ if (!isLikeNone(image_config)) {
337
+ _assertClass(image_config, WasmInlineImageConfig);
338
+ ptr1 = image_config.__destroy_into_raw();
339
+ }
340
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
341
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
342
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
343
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
344
+ if (r2) {
345
+ throw takeObject(r1);
346
+ }
347
+ return WasmHtmlExtraction.__wrap(r0);
348
+ } finally {
349
+ wasm.__wbindgen_add_to_stack_pointer(16);
350
+ }
351
+ }
352
+
353
+ /**
354
+ * @param {Uint8Array} html
355
+ * @param {WasmConversionOptionsHandle} handle
355
356
  * @returns {string}
356
357
  */
357
- export function convertBytes(html, options) {
358
+ export function convertBytesWithOptionsHandle(html, handle) {
358
359
  let deferred2_0;
359
360
  let deferred2_1;
360
361
  try {
361
362
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
362
- wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
363
+ _assertClass(handle, WasmConversionOptionsHandle);
364
+ wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
363
365
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
366
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
367
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -380,34 +382,19 @@ export function convertBytes(html, options) {
380
382
  }
381
383
 
382
384
  /**
383
- * Convert HTML to Markdown
384
- *
385
- * # Arguments
386
- *
387
- * * `html` - The HTML string to convert
388
- * * `options` - Optional conversion options (as a JavaScript object)
389
- *
390
- * # Example
391
- *
392
- * ```javascript
393
- * import { convert } from 'html-to-markdown-wasm';
394
- *
395
- * const html = '<h1>Hello World</h1>';
396
- * const markdown = convert(html);
397
- * console.log(markdown); // # Hello World
398
- * ```
399
385
  * @param {string} html
400
- * @param {any} options
386
+ * @param {WasmConversionOptionsHandle} handle
401
387
  * @returns {string}
402
388
  */
403
- export function convert(html, options) {
389
+ export function convertWithOptionsHandle(html, handle) {
404
390
  let deferred3_0;
405
391
  let deferred3_1;
406
392
  try {
407
393
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
408
394
  const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
409
395
  const len0 = WASM_VECTOR_LEN;
410
- wasm.convert(retptr, ptr0, len0, addHeapObject(options));
396
+ _assertClass(handle, WasmConversionOptionsHandle);
397
+ wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
411
398
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
412
399
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
413
400
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -455,10 +442,23 @@ export function convertBytesWithInlineImages(html, options, image_config) {
455
442
  }
456
443
 
457
444
  /**
458
- * Initialize panic hook for better error messages in the browser
445
+ * @param {any} options
446
+ * @returns {WasmConversionOptionsHandle}
459
447
  */
460
- export function init() {
461
- wasm.init();
448
+ export function createConversionOptionsHandle(options) {
449
+ try {
450
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
451
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
452
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
453
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
454
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
455
+ if (r2) {
456
+ throw takeObject(r1);
457
+ }
458
+ return WasmConversionOptionsHandle.__wrap(r0);
459
+ } finally {
460
+ wasm.__wbindgen_add_to_stack_pointer(16);
461
+ }
462
462
  }
463
463
 
464
464
  const WasmConversionOptionsHandleFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
package/dist/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
6
6
  ],
7
- "version": "2.8.2",
7
+ "version": "2.9.0",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
@@ -9,7 +9,7 @@ High-performance HTML → Markdown conversion powered by Rust. Shipping as a Rus
9
9
  [![Packagist](https://img.shields.io/packagist/v/goldziher/html-to-markdown.svg)](https://packagist.org/packages/goldziher/html-to-markdown)
10
10
  [![RubyGems](https://badge.fury.io/rb/html-to-markdown.svg)](https://rubygems.org/gems/html-to-markdown)
11
11
  [![Hex.pm](https://img.shields.io/hexpm/v/html_to_markdown.svg)](https://hex.pm/packages/html_to_markdown)
12
- [![NuGet](https://img.shields.io/nuget/v/HtmlToMarkdown.svg)](https://www.nuget.org/packages/HtmlToMarkdown/)
12
+ [![NuGet](https://img.shields.io/nuget/v/Goldziher.HtmlToMarkdown.svg)](https://www.nuget.org/packages/Goldziher.HtmlToMarkdown/)
13
13
  [![Maven Central](https://img.shields.io/maven-central/v/io.github.goldziher/html-to-markdown.svg)](https://central.sonatype.com/artifact/io.github.goldziher/html-to-markdown)
14
14
  [![Go Reference](https://pkg.go.dev/badge/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown.svg)](https://pkg.go.dev/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown)
15
15
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
@@ -219,6 +219,20 @@ Need a call-stack view of the Rust core? Run `task flamegraph:rust` (or call the
219
219
 
220
220
  ## Compatibility (v1 → v2)
221
221
 
222
+ ## Testing
223
+
224
+ Use the task runner to execute the entire matrix locally:
225
+
226
+ ```bash
227
+ # All core test suites (Rust, Python, Ruby, Node, PHP, Go, C#, Elixir, Java)
228
+ task test
229
+
230
+ # Run the Wasmtime-backed WASM integration tests
231
+ task wasm:test:wasmtime
232
+ ```
233
+
234
+ The Wasmtime suite builds the `html-to-markdown-wasm` artifact with the same flags used in CI and drives it through Wasmtime to ensure the non-JS runtime behaves exactly like the browser/Deno builds.
235
+
222
236
  - V2’s Rust core sustains **150–210 MB/s** throughput; V1 averaged **≈ 2.5 MB/s** in its Python/BeautifulSoup implementation (60–80× faster).
223
237
  - The Python package offers a compatibility shim in `html_to_markdown.v1_compat` (`convert_to_markdown`, `convert_to_markdown_stream`, `markdownify`). The shim is deprecated, emits `DeprecationWarning` on every call, and will be removed in v3.0—plan migrations now. Details and keyword mappings live in [Python README](https://github.com/Goldziher/html-to-markdown/blob/main/packages/python/README.md#v1-compatibility).
224
238
  - CLI flag changes, option renames, and other breaking updates are summarised in [CHANGELOG](https://github.com/Goldziher/html-to-markdown/blob/main/CHANGELOG.md#breaking-changes).
@@ -1,9 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
4
- export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
5
- export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
6
- export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
3
+ /**
4
+ * Initialize panic hook for better error messages in the browser
5
+ */
6
+ export function init(): void;
7
7
  export function convertBytes(html: Uint8Array, options: any): string;
8
8
  /**
9
9
  * Convert HTML to Markdown
@@ -24,11 +24,11 @@ export function convertBytes(html: Uint8Array, options: any): string;
24
24
  * ```
25
25
  */
26
26
  export function convert(html: string, options: any): string;
27
+ export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
28
+ export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
29
+ export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
27
30
  export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
28
- /**
29
- * Initialize panic hook for better error messages in the browser
30
- */
31
- export function init(): void;
31
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
34
34
  [Symbol.dispose](): void;
@@ -222,71 +222,23 @@ function getArrayJsValueFromWasm0(ptr, len) {
222
222
  return result;
223
223
  }
224
224
  /**
225
- * @param {any} options
226
- * @returns {WasmConversionOptionsHandle}
227
- */
228
- exports.createConversionOptionsHandle = function(options) {
229
- try {
230
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
231
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
232
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
233
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
234
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
235
- if (r2) {
236
- throw takeObject(r1);
237
- }
238
- return WasmConversionOptionsHandle.__wrap(r0);
239
- } finally {
240
- wasm.__wbindgen_add_to_stack_pointer(16);
241
- }
242
- };
243
-
244
- function _assertClass(instance, klass) {
245
- if (!(instance instanceof klass)) {
246
- throw new Error(`expected instance of ${klass.name}`);
247
- }
248
- }
249
- /**
250
- * @param {string} html
251
- * @param {any} options
252
- * @param {WasmInlineImageConfig | null} [image_config]
253
- * @returns {WasmHtmlExtraction}
225
+ * Initialize panic hook for better error messages in the browser
254
226
  */
255
- exports.convertWithInlineImages = function(html, options, image_config) {
256
- try {
257
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
258
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
259
- const len0 = WASM_VECTOR_LEN;
260
- let ptr1 = 0;
261
- if (!isLikeNone(image_config)) {
262
- _assertClass(image_config, WasmInlineImageConfig);
263
- ptr1 = image_config.__destroy_into_raw();
264
- }
265
- wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
266
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
267
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
268
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
269
- if (r2) {
270
- throw takeObject(r1);
271
- }
272
- return WasmHtmlExtraction.__wrap(r0);
273
- } finally {
274
- wasm.__wbindgen_add_to_stack_pointer(16);
275
- }
227
+ exports.init = function() {
228
+ wasm.init();
276
229
  };
277
230
 
278
231
  /**
279
232
  * @param {Uint8Array} html
280
- * @param {WasmConversionOptionsHandle} handle
233
+ * @param {any} options
281
234
  * @returns {string}
282
235
  */
283
- exports.convertBytesWithOptionsHandle = function(html, handle) {
236
+ exports.convertBytes = function(html, options) {
284
237
  let deferred2_0;
285
238
  let deferred2_1;
286
239
  try {
287
240
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
288
- _assertClass(handle, WasmConversionOptionsHandle);
289
- wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
241
+ wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
290
242
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
291
243
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
292
244
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -307,19 +259,34 @@ exports.convertBytesWithOptionsHandle = function(html, handle) {
307
259
  };
308
260
 
309
261
  /**
262
+ * Convert HTML to Markdown
263
+ *
264
+ * # Arguments
265
+ *
266
+ * * `html` - The HTML string to convert
267
+ * * `options` - Optional conversion options (as a JavaScript object)
268
+ *
269
+ * # Example
270
+ *
271
+ * ```javascript
272
+ * import { convert } from 'html-to-markdown-wasm';
273
+ *
274
+ * const html = '<h1>Hello World</h1>';
275
+ * const markdown = convert(html);
276
+ * console.log(markdown); // # Hello World
277
+ * ```
310
278
  * @param {string} html
311
- * @param {WasmConversionOptionsHandle} handle
279
+ * @param {any} options
312
280
  * @returns {string}
313
281
  */
314
- exports.convertWithOptionsHandle = function(html, handle) {
282
+ exports.convert = function(html, options) {
315
283
  let deferred3_0;
316
284
  let deferred3_1;
317
285
  try {
318
286
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
319
287
  const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
320
288
  const len0 = WASM_VECTOR_LEN;
321
- _assertClass(handle, WasmConversionOptionsHandle);
322
- wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
289
+ wasm.convert(retptr, ptr0, len0, addHeapObject(options));
323
290
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
324
291
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
325
292
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -339,17 +306,52 @@ exports.convertWithOptionsHandle = function(html, handle) {
339
306
  }
340
307
  };
341
308
 
309
+ function _assertClass(instance, klass) {
310
+ if (!(instance instanceof klass)) {
311
+ throw new Error(`expected instance of ${klass.name}`);
312
+ }
313
+ }
342
314
  /**
343
- * @param {Uint8Array} html
315
+ * @param {string} html
344
316
  * @param {any} options
317
+ * @param {WasmInlineImageConfig | null} [image_config]
318
+ * @returns {WasmHtmlExtraction}
319
+ */
320
+ exports.convertWithInlineImages = function(html, options, image_config) {
321
+ try {
322
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
323
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ let ptr1 = 0;
326
+ if (!isLikeNone(image_config)) {
327
+ _assertClass(image_config, WasmInlineImageConfig);
328
+ ptr1 = image_config.__destroy_into_raw();
329
+ }
330
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
331
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
332
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
333
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
334
+ if (r2) {
335
+ throw takeObject(r1);
336
+ }
337
+ return WasmHtmlExtraction.__wrap(r0);
338
+ } finally {
339
+ wasm.__wbindgen_add_to_stack_pointer(16);
340
+ }
341
+ };
342
+
343
+ /**
344
+ * @param {Uint8Array} html
345
+ * @param {WasmConversionOptionsHandle} handle
345
346
  * @returns {string}
346
347
  */
347
- exports.convertBytes = function(html, options) {
348
+ exports.convertBytesWithOptionsHandle = function(html, handle) {
348
349
  let deferred2_0;
349
350
  let deferred2_1;
350
351
  try {
351
352
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
352
- wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
353
+ _assertClass(handle, WasmConversionOptionsHandle);
354
+ wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
353
355
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
354
356
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
355
357
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -370,34 +372,19 @@ exports.convertBytes = function(html, options) {
370
372
  };
371
373
 
372
374
  /**
373
- * Convert HTML to Markdown
374
- *
375
- * # Arguments
376
- *
377
- * * `html` - The HTML string to convert
378
- * * `options` - Optional conversion options (as a JavaScript object)
379
- *
380
- * # Example
381
- *
382
- * ```javascript
383
- * import { convert } from 'html-to-markdown-wasm';
384
- *
385
- * const html = '<h1>Hello World</h1>';
386
- * const markdown = convert(html);
387
- * console.log(markdown); // # Hello World
388
- * ```
389
375
  * @param {string} html
390
- * @param {any} options
376
+ * @param {WasmConversionOptionsHandle} handle
391
377
  * @returns {string}
392
378
  */
393
- exports.convert = function(html, options) {
379
+ exports.convertWithOptionsHandle = function(html, handle) {
394
380
  let deferred3_0;
395
381
  let deferred3_1;
396
382
  try {
397
383
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
398
384
  const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
399
385
  const len0 = WASM_VECTOR_LEN;
400
- wasm.convert(retptr, ptr0, len0, addHeapObject(options));
386
+ _assertClass(handle, WasmConversionOptionsHandle);
387
+ wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
401
388
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
402
389
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
403
390
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -445,10 +432,23 @@ exports.convertBytesWithInlineImages = function(html, options, image_config) {
445
432
  };
446
433
 
447
434
  /**
448
- * Initialize panic hook for better error messages in the browser
435
+ * @param {any} options
436
+ * @returns {WasmConversionOptionsHandle}
449
437
  */
450
- exports.init = function() {
451
- wasm.init();
438
+ exports.createConversionOptionsHandle = function(options) {
439
+ try {
440
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
441
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
442
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
443
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
444
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
445
+ if (r2) {
446
+ throw takeObject(r1);
447
+ }
448
+ return WasmConversionOptionsHandle.__wrap(r0);
449
+ } finally {
450
+ wasm.__wbindgen_add_to_stack_pointer(16);
451
+ }
452
452
  };
453
453
 
454
454
  const WasmConversionOptionsHandleFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
5
5
  ],
6
- "version": "2.8.2",
6
+ "version": "2.9.0",
7
7
  "license": "MIT",
8
8
  "repository": {
9
9
  "type": "git",
@@ -9,7 +9,7 @@ High-performance HTML → Markdown conversion powered by Rust. Shipping as a Rus
9
9
  [![Packagist](https://img.shields.io/packagist/v/goldziher/html-to-markdown.svg)](https://packagist.org/packages/goldziher/html-to-markdown)
10
10
  [![RubyGems](https://badge.fury.io/rb/html-to-markdown.svg)](https://rubygems.org/gems/html-to-markdown)
11
11
  [![Hex.pm](https://img.shields.io/hexpm/v/html_to_markdown.svg)](https://hex.pm/packages/html_to_markdown)
12
- [![NuGet](https://img.shields.io/nuget/v/HtmlToMarkdown.svg)](https://www.nuget.org/packages/HtmlToMarkdown/)
12
+ [![NuGet](https://img.shields.io/nuget/v/Goldziher.HtmlToMarkdown.svg)](https://www.nuget.org/packages/Goldziher.HtmlToMarkdown/)
13
13
  [![Maven Central](https://img.shields.io/maven-central/v/io.github.goldziher/html-to-markdown.svg)](https://central.sonatype.com/artifact/io.github.goldziher/html-to-markdown)
14
14
  [![Go Reference](https://pkg.go.dev/badge/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown.svg)](https://pkg.go.dev/github.com/Goldziher/html-to-markdown/packages/go/htmltomarkdown)
15
15
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
@@ -219,6 +219,20 @@ Need a call-stack view of the Rust core? Run `task flamegraph:rust` (or call the
219
219
 
220
220
  ## Compatibility (v1 → v2)
221
221
 
222
+ ## Testing
223
+
224
+ Use the task runner to execute the entire matrix locally:
225
+
226
+ ```bash
227
+ # All core test suites (Rust, Python, Ruby, Node, PHP, Go, C#, Elixir, Java)
228
+ task test
229
+
230
+ # Run the Wasmtime-backed WASM integration tests
231
+ task wasm:test:wasmtime
232
+ ```
233
+
234
+ The Wasmtime suite builds the `html-to-markdown-wasm` artifact with the same flags used in CI and drives it through Wasmtime to ensure the non-JS runtime behaves exactly like the browser/Deno builds.
235
+
222
236
  - V2’s Rust core sustains **150–210 MB/s** throughput; V1 averaged **≈ 2.5 MB/s** in its Python/BeautifulSoup implementation (60–80× faster).
223
237
  - The Python package offers a compatibility shim in `html_to_markdown.v1_compat` (`convert_to_markdown`, `convert_to_markdown_stream`, `markdownify`). The shim is deprecated, emits `DeprecationWarning` on every call, and will be removed in v3.0—plan migrations now. Details and keyword mappings live in [Python README](https://github.com/Goldziher/html-to-markdown/blob/main/packages/python/README.md#v1-compatibility).
224
238
  - CLI flag changes, option renames, and other breaking updates are summarised in [CHANGELOG](https://github.com/Goldziher/html-to-markdown/blob/main/CHANGELOG.md#breaking-changes).
@@ -1,9 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
4
- export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
5
- export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
6
- export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
3
+ /**
4
+ * Initialize panic hook for better error messages in the browser
5
+ */
6
+ export function init(): void;
7
7
  export function convertBytes(html: Uint8Array, options: any): string;
8
8
  /**
9
9
  * Convert HTML to Markdown
@@ -24,11 +24,11 @@ export function convertBytes(html: Uint8Array, options: any): string;
24
24
  * ```
25
25
  */
26
26
  export function convert(html: string, options: any): string;
27
+ export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
28
+ export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
29
+ export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
27
30
  export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
28
- /**
29
- * Initialize panic hook for better error messages in the browser
30
- */
31
- export function init(): void;
31
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
34
34
  [Symbol.dispose](): void;
@@ -228,71 +228,23 @@ function getArrayJsValueFromWasm0(ptr, len) {
228
228
  return result;
229
229
  }
230
230
  /**
231
- * @param {any} options
232
- * @returns {WasmConversionOptionsHandle}
233
- */
234
- export function createConversionOptionsHandle(options) {
235
- try {
236
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
237
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
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 WasmConversionOptionsHandle.__wrap(r0);
245
- } finally {
246
- wasm.__wbindgen_add_to_stack_pointer(16);
247
- }
248
- }
249
-
250
- function _assertClass(instance, klass) {
251
- if (!(instance instanceof klass)) {
252
- throw new Error(`expected instance of ${klass.name}`);
253
- }
254
- }
255
- /**
256
- * @param {string} html
257
- * @param {any} options
258
- * @param {WasmInlineImageConfig | null} [image_config]
259
- * @returns {WasmHtmlExtraction}
231
+ * Initialize panic hook for better error messages in the browser
260
232
  */
261
- export function convertWithInlineImages(html, options, image_config) {
262
- try {
263
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
264
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
265
- const len0 = WASM_VECTOR_LEN;
266
- let ptr1 = 0;
267
- if (!isLikeNone(image_config)) {
268
- _assertClass(image_config, WasmInlineImageConfig);
269
- ptr1 = image_config.__destroy_into_raw();
270
- }
271
- wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
272
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
273
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
274
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
275
- if (r2) {
276
- throw takeObject(r1);
277
- }
278
- return WasmHtmlExtraction.__wrap(r0);
279
- } finally {
280
- wasm.__wbindgen_add_to_stack_pointer(16);
281
- }
233
+ export function init() {
234
+ wasm.init();
282
235
  }
283
236
 
284
237
  /**
285
238
  * @param {Uint8Array} html
286
- * @param {WasmConversionOptionsHandle} handle
239
+ * @param {any} options
287
240
  * @returns {string}
288
241
  */
289
- export function convertBytesWithOptionsHandle(html, handle) {
242
+ export function convertBytes(html, options) {
290
243
  let deferred2_0;
291
244
  let deferred2_1;
292
245
  try {
293
246
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
294
- _assertClass(handle, WasmConversionOptionsHandle);
295
- wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
247
+ wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
296
248
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
297
249
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
298
250
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -313,19 +265,34 @@ export function convertBytesWithOptionsHandle(html, handle) {
313
265
  }
314
266
 
315
267
  /**
268
+ * Convert HTML to Markdown
269
+ *
270
+ * # Arguments
271
+ *
272
+ * * `html` - The HTML string to convert
273
+ * * `options` - Optional conversion options (as a JavaScript object)
274
+ *
275
+ * # Example
276
+ *
277
+ * ```javascript
278
+ * import { convert } from 'html-to-markdown-wasm';
279
+ *
280
+ * const html = '<h1>Hello World</h1>';
281
+ * const markdown = convert(html);
282
+ * console.log(markdown); // # Hello World
283
+ * ```
316
284
  * @param {string} html
317
- * @param {WasmConversionOptionsHandle} handle
285
+ * @param {any} options
318
286
  * @returns {string}
319
287
  */
320
- export function convertWithOptionsHandle(html, handle) {
288
+ export function convert(html, options) {
321
289
  let deferred3_0;
322
290
  let deferred3_1;
323
291
  try {
324
292
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
325
293
  const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
326
294
  const len0 = WASM_VECTOR_LEN;
327
- _assertClass(handle, WasmConversionOptionsHandle);
328
- wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
295
+ wasm.convert(retptr, ptr0, len0, addHeapObject(options));
329
296
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
330
297
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
331
298
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -345,17 +312,52 @@ export function convertWithOptionsHandle(html, handle) {
345
312
  }
346
313
  }
347
314
 
315
+ function _assertClass(instance, klass) {
316
+ if (!(instance instanceof klass)) {
317
+ throw new Error(`expected instance of ${klass.name}`);
318
+ }
319
+ }
348
320
  /**
349
- * @param {Uint8Array} html
321
+ * @param {string} html
350
322
  * @param {any} options
323
+ * @param {WasmInlineImageConfig | null} [image_config]
324
+ * @returns {WasmHtmlExtraction}
325
+ */
326
+ export function convertWithInlineImages(html, options, image_config) {
327
+ try {
328
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
329
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
330
+ const len0 = WASM_VECTOR_LEN;
331
+ let ptr1 = 0;
332
+ if (!isLikeNone(image_config)) {
333
+ _assertClass(image_config, WasmInlineImageConfig);
334
+ ptr1 = image_config.__destroy_into_raw();
335
+ }
336
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
337
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
338
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
339
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
340
+ if (r2) {
341
+ throw takeObject(r1);
342
+ }
343
+ return WasmHtmlExtraction.__wrap(r0);
344
+ } finally {
345
+ wasm.__wbindgen_add_to_stack_pointer(16);
346
+ }
347
+ }
348
+
349
+ /**
350
+ * @param {Uint8Array} html
351
+ * @param {WasmConversionOptionsHandle} handle
351
352
  * @returns {string}
352
353
  */
353
- export function convertBytes(html, options) {
354
+ export function convertBytesWithOptionsHandle(html, handle) {
354
355
  let deferred2_0;
355
356
  let deferred2_1;
356
357
  try {
357
358
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
358
- wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
359
+ _assertClass(handle, WasmConversionOptionsHandle);
360
+ wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
359
361
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
360
362
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
361
363
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -376,34 +378,19 @@ export function convertBytes(html, options) {
376
378
  }
377
379
 
378
380
  /**
379
- * Convert HTML to Markdown
380
- *
381
- * # Arguments
382
- *
383
- * * `html` - The HTML string to convert
384
- * * `options` - Optional conversion options (as a JavaScript object)
385
- *
386
- * # Example
387
- *
388
- * ```javascript
389
- * import { convert } from 'html-to-markdown-wasm';
390
- *
391
- * const html = '<h1>Hello World</h1>';
392
- * const markdown = convert(html);
393
- * console.log(markdown); // # Hello World
394
- * ```
395
381
  * @param {string} html
396
- * @param {any} options
382
+ * @param {WasmConversionOptionsHandle} handle
397
383
  * @returns {string}
398
384
  */
399
- export function convert(html, options) {
385
+ export function convertWithOptionsHandle(html, handle) {
400
386
  let deferred3_0;
401
387
  let deferred3_1;
402
388
  try {
403
389
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
404
390
  const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
405
391
  const len0 = WASM_VECTOR_LEN;
406
- wasm.convert(retptr, ptr0, len0, addHeapObject(options));
392
+ _assertClass(handle, WasmConversionOptionsHandle);
393
+ wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
407
394
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
408
395
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
409
396
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -451,10 +438,23 @@ export function convertBytesWithInlineImages(html, options, image_config) {
451
438
  }
452
439
 
453
440
  /**
454
- * Initialize panic hook for better error messages in the browser
441
+ * @param {any} options
442
+ * @returns {WasmConversionOptionsHandle}
455
443
  */
456
- export function init() {
457
- wasm.init();
444
+ export function createConversionOptionsHandle(options) {
445
+ try {
446
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
447
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
448
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
451
+ if (r2) {
452
+ throw takeObject(r1);
453
+ }
454
+ return WasmConversionOptionsHandle.__wrap(r0);
455
+ } finally {
456
+ wasm.__wbindgen_add_to_stack_pointer(16);
457
+ }
458
458
  }
459
459
 
460
460
  const WasmConversionOptionsHandleFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
6
6
  ],
7
- "version": "2.8.2",
7
+ "version": "2.9.0",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-to-markdown-wasm",
3
- "version": "2.8.2",
3
+ "version": "2.9.0",
4
4
  "description": "High-performance HTML to Markdown converter - WebAssembly bindings",
5
5
  "main": "dist/html_to_markdown_wasm.js",
6
6
  "types": "dist/html_to_markdown_wasm.d.ts",
@@ -55,7 +55,7 @@
55
55
  "devDependencies": {
56
56
  "@types/node": "^24.10.1",
57
57
  "tsx": "^4.20.6",
58
- "vitest": "^4.0.8",
58
+ "vitest": "^4.0.11",
59
59
  "wasm-pack": "^0.13.1"
60
60
  },
61
61
  "publishConfig": {