html-to-markdown-wasm 2.9.1 → 2.10.1

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.
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
5
5
  ],
6
- "version": "2.9.1",
6
+ "version": "2.10.1",
7
7
  "license": "MIT",
8
8
  "repository": {
9
9
  "type": "git",
@@ -51,19 +51,19 @@ Experience WebAssembly-powered HTML to Markdown conversion instantly in your bro
51
51
 
52
52
  ## Installation
53
53
 
54
- | Target | Command |
55
- | --------------------------- | ------------------------------------------------------------------------- |
56
- | **Node.js/Bun** (native) | `npm install html-to-markdown-node` |
57
- | **WebAssembly** (universal) | `npm install html-to-markdown-wasm` |
58
- | **Deno** | `import { convert } from "npm:html-to-markdown-wasm"` |
59
- | **Python** (bindings + CLI) | `pip install html-to-markdown` |
60
- | **PHP** (extension + helpers) | `pie install goldziher/html-to-markdown`<br>`composer require html-to-markdown/extension` |
61
- | **Ruby** gem | `bundle add html-to-markdown` or `gem install html-to-markdown` |
62
- | **Elixir** (Rustler NIF) | `{:html_to_markdown, "~> 2.8"}` |
63
- | **Rust** crate | `cargo add html-to-markdown-rs` |
64
- | Rust CLI | `cargo install html-to-markdown-cli` |
65
- | Homebrew CLI | `brew tap goldziher/tap`<br>`brew install html-to-markdown` |
66
- | Releases | [GitHub Releases](https://github.com/Goldziher/html-to-markdown/releases) |
54
+ | Target | Command(s) |
55
+ | --------------------------- | ---------------------------------------------------------------------------------------------------------------- |
56
+ | **Node.js/Bun** (native) | `npm install html-to-markdown-node` |
57
+ | **WebAssembly** (universal) | `npm install html-to-markdown-wasm` |
58
+ | **Deno** | `import { convert } from "npm:html-to-markdown-wasm"` |
59
+ | **Python** (bindings + CLI) | `pip install html-to-markdown` |
60
+ | **PHP** (extension + helpers) | `PHP_EXTENSION_DIR=$(php-config --extension-dir) pie install goldziher/html-to-markdown`<br>`composer require goldziher/html-to-markdown` |
61
+ | **Ruby** gem | `bundle add html-to-markdown` or `gem install html-to-markdown` |
62
+ | **Elixir** (Rustler NIF) | `{:html_to_markdown, "~> 2.8"}` |
63
+ | **Rust** crate | `cargo add html-to-markdown-rs` |
64
+ | Rust CLI (crates.io) | `cargo install html-to-markdown-cli` |
65
+ | Homebrew CLI | `brew install html-to-markdown` (core) |
66
+ | Releases | [GitHub Releases](https://github.com/Goldziher/html-to-markdown/releases) |
67
67
 
68
68
  ## Quick Start
69
69
 
@@ -1,42 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Convert HTML to Markdown
5
- *
6
- * # Arguments
7
- *
8
- * * `html` - The HTML string to convert
9
- * * `options` - Optional conversion options (as a JavaScript object)
10
- *
11
- * # Example
12
- *
13
- * ```javascript
14
- * import { convert } from 'html-to-markdown-wasm';
15
- *
16
- * const html = '<h1>Hello World</h1>';
17
- * const markdown = convert(html);
18
- * console.log(markdown); // # Hello World
19
- * ```
20
- */
21
- export function convert(html: string, options: any): string;
22
- export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
23
- export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
24
- export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
25
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
26
- export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
27
- export function convertBytes(html: Uint8Array, options: any): string;
28
- /**
29
- * Initialize panic hook for better error messages in the browser
30
- */
31
- export function init(): void;
3
+
32
4
  export class WasmConversionOptionsHandle {
33
5
  free(): void;
34
6
  [Symbol.dispose](): void;
35
7
  constructor(options: any);
36
8
  }
37
- /**
38
- * Result of HTML extraction with inline images
39
- */
9
+
40
10
  export class WasmHtmlExtraction {
41
11
  private constructor();
42
12
  free(): void;
@@ -45,9 +15,7 @@ export class WasmHtmlExtraction {
45
15
  readonly markdown: string;
46
16
  readonly warnings: WasmInlineImageWarning[];
47
17
  }
48
- /**
49
- * Inline image data
50
- */
18
+
51
19
  export class WasmInlineImage {
52
20
  private constructor();
53
21
  free(): void;
@@ -60,9 +28,7 @@ export class WasmInlineImage {
60
28
  readonly source: string;
61
29
  readonly filename: string | undefined;
62
30
  }
63
- /**
64
- * Inline image configuration
65
- */
31
+
66
32
  export class WasmInlineImageConfig {
67
33
  free(): void;
68
34
  [Symbol.dispose](): void;
@@ -71,9 +37,7 @@ export class WasmInlineImageConfig {
71
37
  set filenamePrefix(value: string | null | undefined);
72
38
  set inferDimensions(value: boolean);
73
39
  }
74
- /**
75
- * Warning about inline image processing
76
- */
40
+
77
41
  export class WasmInlineImageWarning {
78
42
  private constructor();
79
43
  free(): void;
@@ -82,6 +46,43 @@ export class WasmInlineImageWarning {
82
46
  readonly message: string;
83
47
  }
84
48
 
49
+ /**
50
+ * Convert HTML to Markdown
51
+ *
52
+ * # Arguments
53
+ *
54
+ * * `html` - The HTML string to convert
55
+ * * `options` - Optional conversion options (as a JavaScript object)
56
+ *
57
+ * # Example
58
+ *
59
+ * ```javascript
60
+ * import { convert } from 'html-to-markdown-wasm';
61
+ *
62
+ * const html = '<h1>Hello World</h1>';
63
+ * const markdown = convert(html);
64
+ * console.log(markdown); // # Hello World
65
+ * ```
66
+ */
67
+ export function convert(html: string, options: any): string;
68
+
69
+ export function convertBytes(html: Uint8Array, options: any): string;
70
+
71
+ export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
72
+
73
+ export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
74
+
75
+ export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
76
+
77
+ export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
78
+
79
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
80
+
81
+ /**
82
+ * Initialize panic hook for better error messages in the browser
83
+ */
84
+ export function init(): void;
85
+
85
86
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
86
87
 
87
88
  export interface InitOutput {
@@ -125,6 +126,7 @@ export interface InitOutput {
125
126
  }
126
127
 
127
128
  export type SyncInitInput = BufferSource | WebAssembly.Module;
129
+
128
130
  /**
129
131
  * Instantiates the given `module`, which can either be bytes or
130
132
  * a precompiled `WebAssembly.Module`.