html-to-markdown-wasm 2.7.2 → 2.8.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
@@ -9,12 +9,15 @@ Powered by the same Rust engine as the Node.js, Python, Ruby, and PHP bindings,
9
9
 
10
10
  Runs anywhere: Node.js, Deno, Bun, browsers, and edge runtimes.
11
11
 
12
- [![Crates.io](https://img.shields.io/crates/v/html-to-markdown-rs.svg)](https://crates.io/crates/html-to-markdown-rs)
12
+ [![Crates.io](https://img.shields.io/crates/v/html-to-markdown.svg)](https://crates.io/crates/html-to-markdown)
13
13
  [![npm (node)](https://badge.fury.io/js/html-to-markdown-node.svg)](https://www.npmjs.com/package/html-to-markdown-node)
14
14
  [![npm (wasm)](https://badge.fury.io/js/html-to-markdown-wasm.svg)](https://www.npmjs.com/package/html-to-markdown-wasm)
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/)
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
+ [![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)
18
21
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
19
22
 
20
23
  ## Performance
package/dist/README.md CHANGED
@@ -2,12 +2,15 @@
2
2
 
3
3
  High-performance HTML → Markdown conversion powered by Rust. Shipping as a Rust crate, Python package, PHP extension, Ruby gem, Node.js bindings, WebAssembly, and standalone CLI with identical rendering behaviour.
4
4
 
5
- [![Crates.io](https://img.shields.io/crates/v/html-to-markdown-rs.svg)](https://crates.io/crates/html-to-markdown-rs)
5
+ [![Crates.io](https://img.shields.io/crates/v/html-to-markdown.svg)](https://crates.io/crates/html-to-markdown)
6
6
  [![npm (node)](https://badge.fury.io/js/html-to-markdown-node.svg)](https://www.npmjs.com/package/html-to-markdown-node)
7
7
  [![npm (wasm)](https://badge.fury.io/js/html-to-markdown-wasm.svg)](https://www.npmjs.com/package/html-to-markdown-wasm)
8
8
  [![PyPI](https://badge.fury.io/py/html-to-markdown.svg)](https://pypi.org/project/html-to-markdown/)
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
+ [![NuGet](https://img.shields.io/nuget/v/HtmlToMarkdown.svg)](https://www.nuget.org/packages/HtmlToMarkdown/)
12
+ [![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)
13
+ [![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)
11
14
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
12
15
  [![Discord](https://img.shields.io/badge/Discord-Join%20our%20community-7289da)](https://discord.gg/pXxagNK2zN)
13
16
 
@@ -89,7 +92,7 @@ const markdown = convert(html, {
89
92
  });
90
93
  ```
91
94
 
92
- **Performance:** The shared fixture harness (`task bench:bindings`) now clocks Node, Python, and the Rust CLI at ~1.3–1.4k ops/sec (≈150MB/s) on the 129KB Wikipedia Lists page thanks to the new Buffer/Uint8Array fast paths and release-mode harness. Ruby stays close at ~1.2k ops/sec, PHP lands around 0.3k ops/sec (≈35 MB/s), and WASM hits ~0.85k ops/sec—plenty for browsers, Deno, and edge runtimes.
95
+ **Performance:** The shared fixture harness (`task bench:bindings`) now clocks C# at ~1.4k ops/sec (≈171 MB/s), Go at ~1.3k ops/sec (≈165 MB/s), Node, Python, and the Rust CLI at ~1.3–1.4k ops/sec (≈150 MB/s) on the 129 KB Wikipedia "Lists" page thanks to the new Buffer/Uint8Array fast paths and release-mode harness. Ruby stays close at ~1.2k ops/sec (≈150 MB/s), Java lands at ~1.0k ops/sec (≈126 MB/s), WASM hits ~0.85k ops/sec (≈108 MB/s), and PHP achieves ~0.3k ops/sec (≈35 MB/s)—all providing excellent throughput for production workloads.
93
96
 
94
97
  See the JavaScript guides for full API documentation:
95
98
 
@@ -1,6 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
3
+ export function convertBytes(html: Uint8Array, options: any): string;
4
4
  /**
5
5
  * Convert HTML to Markdown
6
6
  *
@@ -20,14 +20,14 @@ export function createConversionOptionsHandle(options: any): WasmConversionOptio
20
20
  * ```
21
21
  */
22
22
  export function convert(html: string, options: any): string;
23
- export function convertBytes(html: Uint8Array, options: any): string;
24
23
  export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
25
- export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
26
- export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
27
24
  /**
28
25
  * Initialize panic hook for better error messages in the browser
29
26
  */
30
27
  export function init(): void;
28
+ export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
29
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
30
+ export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
31
31
  export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
@@ -232,22 +232,32 @@ function getArrayJsValueFromWasm0(ptr, len) {
232
232
  return result;
233
233
  }
234
234
  /**
235
+ * @param {Uint8Array} html
235
236
  * @param {any} options
236
- * @returns {WasmConversionOptionsHandle}
237
+ * @returns {string}
237
238
  */
238
- export function createConversionOptionsHandle(options) {
239
+ export function convertBytes(html, options) {
240
+ let deferred2_0;
241
+ let deferred2_1;
239
242
  try {
240
243
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
241
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
244
+ wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
242
245
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
243
246
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
244
247
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
245
- if (r2) {
246
- throw takeObject(r1);
248
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
249
+ var ptr1 = r0;
250
+ var len1 = r1;
251
+ if (r3) {
252
+ ptr1 = 0; len1 = 0;
253
+ throw takeObject(r2);
247
254
  }
248
- return WasmConversionOptionsHandle.__wrap(r0);
255
+ deferred2_0 = ptr1;
256
+ deferred2_1 = len1;
257
+ return getStringFromWasm0(ptr1, len1);
249
258
  } finally {
250
259
  wasm.__wbindgen_add_to_stack_pointer(16);
260
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
251
261
  }
252
262
  }
253
263
 
@@ -299,36 +309,6 @@ export function convert(html, options) {
299
309
  }
300
310
  }
301
311
 
302
- /**
303
- * @param {Uint8Array} html
304
- * @param {any} options
305
- * @returns {string}
306
- */
307
- export function convertBytes(html, options) {
308
- let deferred2_0;
309
- let deferred2_1;
310
- try {
311
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
312
- wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
313
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
314
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
315
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
316
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
317
- var ptr1 = r0;
318
- var len1 = r1;
319
- if (r3) {
320
- ptr1 = 0; len1 = 0;
321
- throw takeObject(r2);
322
- }
323
- deferred2_0 = ptr1;
324
- deferred2_1 = len1;
325
- return getStringFromWasm0(ptr1, len1);
326
- } finally {
327
- wasm.__wbindgen_add_to_stack_pointer(16);
328
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
329
- }
330
- }
331
-
332
312
  function _assertClass(instance, klass) {
333
313
  if (!(instance instanceof klass)) {
334
314
  throw new Error(`expected instance of ${klass.name}`);
@@ -367,6 +347,13 @@ export function convertWithOptionsHandle(html, handle) {
367
347
  }
368
348
  }
369
349
 
350
+ /**
351
+ * Initialize panic hook for better error messages in the browser
352
+ */
353
+ export function init() {
354
+ wasm.init();
355
+ }
356
+
370
357
  /**
371
358
  * @param {Uint8Array} html
372
359
  * @param {any} options
@@ -394,6 +381,26 @@ export function convertBytesWithInlineImages(html, options, image_config) {
394
381
  }
395
382
  }
396
383
 
384
+ /**
385
+ * @param {any} options
386
+ * @returns {WasmConversionOptionsHandle}
387
+ */
388
+ export function createConversionOptionsHandle(options) {
389
+ try {
390
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
391
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
392
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
393
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
394
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
395
+ if (r2) {
396
+ throw takeObject(r1);
397
+ }
398
+ return WasmConversionOptionsHandle.__wrap(r0);
399
+ } finally {
400
+ wasm.__wbindgen_add_to_stack_pointer(16);
401
+ }
402
+ }
403
+
397
404
  /**
398
405
  * @param {Uint8Array} html
399
406
  * @param {WasmConversionOptionsHandle} handle
@@ -425,13 +432,6 @@ export function convertBytesWithOptionsHandle(html, handle) {
425
432
  }
426
433
  }
427
434
 
428
- /**
429
- * Initialize panic hook for better error messages in the browser
430
- */
431
- export function init() {
432
- wasm.init();
433
- }
434
-
435
435
  /**
436
436
  * @param {string} html
437
437
  * @param {any} options
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.7.2",
7
+ "version": "2.8.0",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
@@ -2,12 +2,15 @@
2
2
 
3
3
  High-performance HTML → Markdown conversion powered by Rust. Shipping as a Rust crate, Python package, PHP extension, Ruby gem, Node.js bindings, WebAssembly, and standalone CLI with identical rendering behaviour.
4
4
 
5
- [![Crates.io](https://img.shields.io/crates/v/html-to-markdown-rs.svg)](https://crates.io/crates/html-to-markdown-rs)
5
+ [![Crates.io](https://img.shields.io/crates/v/html-to-markdown.svg)](https://crates.io/crates/html-to-markdown)
6
6
  [![npm (node)](https://badge.fury.io/js/html-to-markdown-node.svg)](https://www.npmjs.com/package/html-to-markdown-node)
7
7
  [![npm (wasm)](https://badge.fury.io/js/html-to-markdown-wasm.svg)](https://www.npmjs.com/package/html-to-markdown-wasm)
8
8
  [![PyPI](https://badge.fury.io/py/html-to-markdown.svg)](https://pypi.org/project/html-to-markdown/)
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
+ [![NuGet](https://img.shields.io/nuget/v/HtmlToMarkdown.svg)](https://www.nuget.org/packages/HtmlToMarkdown/)
12
+ [![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)
13
+ [![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)
11
14
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
12
15
  [![Discord](https://img.shields.io/badge/Discord-Join%20our%20community-7289da)](https://discord.gg/pXxagNK2zN)
13
16
 
@@ -89,7 +92,7 @@ const markdown = convert(html, {
89
92
  });
90
93
  ```
91
94
 
92
- **Performance:** The shared fixture harness (`task bench:bindings`) now clocks Node, Python, and the Rust CLI at ~1.3–1.4k ops/sec (≈150MB/s) on the 129KB Wikipedia Lists page thanks to the new Buffer/Uint8Array fast paths and release-mode harness. Ruby stays close at ~1.2k ops/sec, PHP lands around 0.3k ops/sec (≈35 MB/s), and WASM hits ~0.85k ops/sec—plenty for browsers, Deno, and edge runtimes.
95
+ **Performance:** The shared fixture harness (`task bench:bindings`) now clocks C# at ~1.4k ops/sec (≈171 MB/s), Go at ~1.3k ops/sec (≈165 MB/s), Node, Python, and the Rust CLI at ~1.3–1.4k ops/sec (≈150 MB/s) on the 129 KB Wikipedia "Lists" page thanks to the new Buffer/Uint8Array fast paths and release-mode harness. Ruby stays close at ~1.2k ops/sec (≈150 MB/s), Java lands at ~1.0k ops/sec (≈126 MB/s), WASM hits ~0.85k ops/sec (≈108 MB/s), and PHP achieves ~0.3k ops/sec (≈35 MB/s)—all providing excellent throughput for production workloads.
93
96
 
94
97
  See the JavaScript guides for full API documentation:
95
98
 
@@ -1,6 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
3
+ export function convertBytes(html: Uint8Array, options: any): string;
4
4
  /**
5
5
  * Convert HTML to Markdown
6
6
  *
@@ -20,14 +20,14 @@ export function createConversionOptionsHandle(options: any): WasmConversionOptio
20
20
  * ```
21
21
  */
22
22
  export function convert(html: string, options: any): string;
23
- export function convertBytes(html: Uint8Array, options: any): string;
24
23
  export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
25
- export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
26
- export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
27
24
  /**
28
25
  * Initialize panic hook for better error messages in the browser
29
26
  */
30
27
  export function init(): void;
28
+ export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
29
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
30
+ export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
31
31
  export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
@@ -222,22 +222,32 @@ function getArrayJsValueFromWasm0(ptr, len) {
222
222
  return result;
223
223
  }
224
224
  /**
225
+ * @param {Uint8Array} html
225
226
  * @param {any} options
226
- * @returns {WasmConversionOptionsHandle}
227
+ * @returns {string}
227
228
  */
228
- exports.createConversionOptionsHandle = function(options) {
229
+ exports.convertBytes = function(html, options) {
230
+ let deferred2_0;
231
+ let deferred2_1;
229
232
  try {
230
233
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
231
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
234
+ wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
232
235
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
233
236
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
234
237
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
235
- if (r2) {
236
- throw takeObject(r1);
238
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
239
+ var ptr1 = r0;
240
+ var len1 = r1;
241
+ if (r3) {
242
+ ptr1 = 0; len1 = 0;
243
+ throw takeObject(r2);
237
244
  }
238
- return WasmConversionOptionsHandle.__wrap(r0);
245
+ deferred2_0 = ptr1;
246
+ deferred2_1 = len1;
247
+ return getStringFromWasm0(ptr1, len1);
239
248
  } finally {
240
249
  wasm.__wbindgen_add_to_stack_pointer(16);
250
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
241
251
  }
242
252
  };
243
253
 
@@ -289,36 +299,6 @@ exports.convert = function(html, options) {
289
299
  }
290
300
  };
291
301
 
292
- /**
293
- * @param {Uint8Array} html
294
- * @param {any} options
295
- * @returns {string}
296
- */
297
- exports.convertBytes = function(html, options) {
298
- let deferred2_0;
299
- let deferred2_1;
300
- try {
301
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
302
- wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
303
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
304
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
305
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
306
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
307
- var ptr1 = r0;
308
- var len1 = r1;
309
- if (r3) {
310
- ptr1 = 0; len1 = 0;
311
- throw takeObject(r2);
312
- }
313
- deferred2_0 = ptr1;
314
- deferred2_1 = len1;
315
- return getStringFromWasm0(ptr1, len1);
316
- } finally {
317
- wasm.__wbindgen_add_to_stack_pointer(16);
318
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
319
- }
320
- };
321
-
322
302
  function _assertClass(instance, klass) {
323
303
  if (!(instance instanceof klass)) {
324
304
  throw new Error(`expected instance of ${klass.name}`);
@@ -357,6 +337,13 @@ exports.convertWithOptionsHandle = function(html, handle) {
357
337
  }
358
338
  };
359
339
 
340
+ /**
341
+ * Initialize panic hook for better error messages in the browser
342
+ */
343
+ exports.init = function() {
344
+ wasm.init();
345
+ };
346
+
360
347
  /**
361
348
  * @param {Uint8Array} html
362
349
  * @param {any} options
@@ -384,6 +371,26 @@ exports.convertBytesWithInlineImages = function(html, options, image_config) {
384
371
  }
385
372
  };
386
373
 
374
+ /**
375
+ * @param {any} options
376
+ * @returns {WasmConversionOptionsHandle}
377
+ */
378
+ exports.createConversionOptionsHandle = function(options) {
379
+ try {
380
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
381
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
382
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
383
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
384
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
385
+ if (r2) {
386
+ throw takeObject(r1);
387
+ }
388
+ return WasmConversionOptionsHandle.__wrap(r0);
389
+ } finally {
390
+ wasm.__wbindgen_add_to_stack_pointer(16);
391
+ }
392
+ };
393
+
387
394
  /**
388
395
  * @param {Uint8Array} html
389
396
  * @param {WasmConversionOptionsHandle} handle
@@ -415,13 +422,6 @@ exports.convertBytesWithOptionsHandle = function(html, handle) {
415
422
  }
416
423
  };
417
424
 
418
- /**
419
- * Initialize panic hook for better error messages in the browser
420
- */
421
- exports.init = function() {
422
- wasm.init();
423
- };
424
-
425
425
  /**
426
426
  * @param {string} html
427
427
  * @param {any} options
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
5
5
  ],
6
- "version": "2.7.2",
6
+ "version": "2.8.0",
7
7
  "license": "MIT",
8
8
  "repository": {
9
9
  "type": "git",
@@ -2,12 +2,15 @@
2
2
 
3
3
  High-performance HTML → Markdown conversion powered by Rust. Shipping as a Rust crate, Python package, PHP extension, Ruby gem, Node.js bindings, WebAssembly, and standalone CLI with identical rendering behaviour.
4
4
 
5
- [![Crates.io](https://img.shields.io/crates/v/html-to-markdown-rs.svg)](https://crates.io/crates/html-to-markdown-rs)
5
+ [![Crates.io](https://img.shields.io/crates/v/html-to-markdown.svg)](https://crates.io/crates/html-to-markdown)
6
6
  [![npm (node)](https://badge.fury.io/js/html-to-markdown-node.svg)](https://www.npmjs.com/package/html-to-markdown-node)
7
7
  [![npm (wasm)](https://badge.fury.io/js/html-to-markdown-wasm.svg)](https://www.npmjs.com/package/html-to-markdown-wasm)
8
8
  [![PyPI](https://badge.fury.io/py/html-to-markdown.svg)](https://pypi.org/project/html-to-markdown/)
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
+ [![NuGet](https://img.shields.io/nuget/v/HtmlToMarkdown.svg)](https://www.nuget.org/packages/HtmlToMarkdown/)
12
+ [![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)
13
+ [![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)
11
14
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
12
15
  [![Discord](https://img.shields.io/badge/Discord-Join%20our%20community-7289da)](https://discord.gg/pXxagNK2zN)
13
16
 
@@ -89,7 +92,7 @@ const markdown = convert(html, {
89
92
  });
90
93
  ```
91
94
 
92
- **Performance:** The shared fixture harness (`task bench:bindings`) now clocks Node, Python, and the Rust CLI at ~1.3–1.4k ops/sec (≈150MB/s) on the 129KB Wikipedia Lists page thanks to the new Buffer/Uint8Array fast paths and release-mode harness. Ruby stays close at ~1.2k ops/sec, PHP lands around 0.3k ops/sec (≈35 MB/s), and WASM hits ~0.85k ops/sec—plenty for browsers, Deno, and edge runtimes.
95
+ **Performance:** The shared fixture harness (`task bench:bindings`) now clocks C# at ~1.4k ops/sec (≈171 MB/s), Go at ~1.3k ops/sec (≈165 MB/s), Node, Python, and the Rust CLI at ~1.3–1.4k ops/sec (≈150 MB/s) on the 129 KB Wikipedia "Lists" page thanks to the new Buffer/Uint8Array fast paths and release-mode harness. Ruby stays close at ~1.2k ops/sec (≈150 MB/s), Java lands at ~1.0k ops/sec (≈126 MB/s), WASM hits ~0.85k ops/sec (≈108 MB/s), and PHP achieves ~0.3k ops/sec (≈35 MB/s)—all providing excellent throughput for production workloads.
93
96
 
94
97
  See the JavaScript guides for full API documentation:
95
98
 
@@ -1,6 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
3
+ export function convertBytes(html: Uint8Array, options: any): string;
4
4
  /**
5
5
  * Convert HTML to Markdown
6
6
  *
@@ -20,14 +20,14 @@ export function createConversionOptionsHandle(options: any): WasmConversionOptio
20
20
  * ```
21
21
  */
22
22
  export function convert(html: string, options: any): string;
23
- export function convertBytes(html: Uint8Array, options: any): string;
24
23
  export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
25
- export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
26
- export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
27
24
  /**
28
25
  * Initialize panic hook for better error messages in the browser
29
26
  */
30
27
  export function init(): void;
28
+ export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
29
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
30
+ export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
31
31
  export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
@@ -228,22 +228,32 @@ function getArrayJsValueFromWasm0(ptr, len) {
228
228
  return result;
229
229
  }
230
230
  /**
231
+ * @param {Uint8Array} html
231
232
  * @param {any} options
232
- * @returns {WasmConversionOptionsHandle}
233
+ * @returns {string}
233
234
  */
234
- export function createConversionOptionsHandle(options) {
235
+ export function convertBytes(html, options) {
236
+ let deferred2_0;
237
+ let deferred2_1;
235
238
  try {
236
239
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
237
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
240
+ wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
238
241
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
239
242
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
240
243
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
241
- if (r2) {
242
- throw takeObject(r1);
244
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
245
+ var ptr1 = r0;
246
+ var len1 = r1;
247
+ if (r3) {
248
+ ptr1 = 0; len1 = 0;
249
+ throw takeObject(r2);
243
250
  }
244
- return WasmConversionOptionsHandle.__wrap(r0);
251
+ deferred2_0 = ptr1;
252
+ deferred2_1 = len1;
253
+ return getStringFromWasm0(ptr1, len1);
245
254
  } finally {
246
255
  wasm.__wbindgen_add_to_stack_pointer(16);
256
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
247
257
  }
248
258
  }
249
259
 
@@ -295,36 +305,6 @@ export function convert(html, options) {
295
305
  }
296
306
  }
297
307
 
298
- /**
299
- * @param {Uint8Array} html
300
- * @param {any} options
301
- * @returns {string}
302
- */
303
- export function convertBytes(html, options) {
304
- let deferred2_0;
305
- let deferred2_1;
306
- try {
307
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
308
- wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
309
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
310
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
311
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
312
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
313
- var ptr1 = r0;
314
- var len1 = r1;
315
- if (r3) {
316
- ptr1 = 0; len1 = 0;
317
- throw takeObject(r2);
318
- }
319
- deferred2_0 = ptr1;
320
- deferred2_1 = len1;
321
- return getStringFromWasm0(ptr1, len1);
322
- } finally {
323
- wasm.__wbindgen_add_to_stack_pointer(16);
324
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
325
- }
326
- }
327
-
328
308
  function _assertClass(instance, klass) {
329
309
  if (!(instance instanceof klass)) {
330
310
  throw new Error(`expected instance of ${klass.name}`);
@@ -363,6 +343,13 @@ export function convertWithOptionsHandle(html, handle) {
363
343
  }
364
344
  }
365
345
 
346
+ /**
347
+ * Initialize panic hook for better error messages in the browser
348
+ */
349
+ export function init() {
350
+ wasm.init();
351
+ }
352
+
366
353
  /**
367
354
  * @param {Uint8Array} html
368
355
  * @param {any} options
@@ -390,6 +377,26 @@ export function convertBytesWithInlineImages(html, options, image_config) {
390
377
  }
391
378
  }
392
379
 
380
+ /**
381
+ * @param {any} options
382
+ * @returns {WasmConversionOptionsHandle}
383
+ */
384
+ export function createConversionOptionsHandle(options) {
385
+ try {
386
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
387
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
388
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
389
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
390
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
391
+ if (r2) {
392
+ throw takeObject(r1);
393
+ }
394
+ return WasmConversionOptionsHandle.__wrap(r0);
395
+ } finally {
396
+ wasm.__wbindgen_add_to_stack_pointer(16);
397
+ }
398
+ }
399
+
393
400
  /**
394
401
  * @param {Uint8Array} html
395
402
  * @param {WasmConversionOptionsHandle} handle
@@ -421,13 +428,6 @@ export function convertBytesWithOptionsHandle(html, handle) {
421
428
  }
422
429
  }
423
430
 
424
- /**
425
- * Initialize panic hook for better error messages in the browser
426
- */
427
- export function init() {
428
- wasm.init();
429
- }
430
-
431
431
  /**
432
432
  * @param {string} html
433
433
  * @param {any} options
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
6
6
  ],
7
- "version": "2.7.2",
7
+ "version": "2.8.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.7.2",
3
+ "version": "2.8.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",