html-to-markdown-node 2.16.0 → 2.18.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.
Files changed (4) hide show
  1. package/README.md +5 -5
  2. package/index.d.ts +76 -4
  3. package/index.js +69 -53
  4. package/package.json +13 -13
package/README.md CHANGED
@@ -17,8 +17,8 @@ High-performance HTML to Markdown conversion using native Rust code compiled to
17
17
  [![RubyGems](https://badge.fury.io/rb/html-to-markdown.svg)](https://rubygems.org/gems/html-to-markdown)
18
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
- [![Go Reference](https://pkg.go.dev/badge/github.com/Goldziher/html-to-markdown/packages/go/v2/htmltomarkdown.svg)](https://pkg.go.dev/github.com/Goldziher/html-to-markdown/packages/go/v2/htmltomarkdown)
21
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Goldziher/html-to-markdown/blob/main/LICENSE)
20
+ [![Go Reference](https://pkg.go.dev/badge/github.com/kreuzberg-dev/html-to-markdown/packages/go/v2/htmltomarkdown.svg)](https://pkg.go.dev/github.com/kreuzberg-dev/html-to-markdown/packages/go/v2/htmltomarkdown)
21
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/kreuzberg-dev/html-to-markdown/blob/main/LICENSE)
22
22
 
23
23
  ## Performance
24
24
 
@@ -257,7 +257,7 @@ Other runtimes:
257
257
 
258
258
  ## Configuration Options
259
259
 
260
- See [ConversionOptions](https://github.com/Goldziher/html-to-markdown/tree/main/crates/html-to-markdown-node#types) for all available options including:
260
+ See [ConversionOptions](https://github.com/kreuzberg-dev/html-to-markdown/tree/main/crates/html-to-markdown-node#types) for all available options including:
261
261
 
262
262
  - Heading styles (ATX, underlined, ATX closed)
263
263
  - Code block styles (indented, backticks, tildes)
@@ -339,8 +339,8 @@ const markdown = convert(hocrHtml, {
339
339
 
340
340
  ## Links
341
341
 
342
- - [GitHub Repository](https://github.com/Goldziher/html-to-markdown)
343
- - [Full Documentation](https://github.com/Goldziher/html-to-markdown/blob/main/README.md)
342
+ - [GitHub Repository](https://github.com/kreuzberg-dev/html-to-markdown)
343
+ - [Full Documentation](https://github.com/kreuzberg-dev/html-to-markdown/blob/main/README.md)
344
344
  - [WASM Package](https://www.npmjs.com/package/html-to-markdown-wasm)
345
345
  - [Python Package](https://pypi.org/project/html-to-markdown/)
346
346
  - [Rust Crate](https://crates.io/crates/html-to-markdown-rs)
package/index.d.ts CHANGED
@@ -8,10 +8,6 @@ export declare class ExternalObject<T> {
8
8
  }
9
9
  }
10
10
  /**
11
- * Convert HTML to Markdown
12
- *
13
- * # Arguments
14
- *
15
11
  * * `html` - The HTML string to convert
16
12
  * * `options` - Optional conversion options
17
13
  *
@@ -107,6 +103,62 @@ export declare function convertWithMetadataJson(html: string, optionsJson?: stri
107
103
  /** Convert HTML using a previously-created ConversionOptions handle. */
108
104
  export declare function convertWithOptionsHandle(html: string, options: ExternalObject<RustConversionOptions>): string
109
105
 
106
+ /**
107
+ * Convert HTML to Markdown with an async visitor object.
108
+ *
109
+ * # Async Visitor Support
110
+ *
111
+ * This function enables full async visitor pattern support for Node.js:
112
+ * - JavaScript visitor callbacks are invoked asynchronously via NAPI ThreadsafeFunction
113
+ * - All 30+ visitor methods are supported (links, images, headings, code, lists, tables, etc.)
114
+ * - Callback errors gracefully default to VisitResult::Continue
115
+ * - Powered by tokio async runtime for seamless JS-Rust cooperation
116
+ *
117
+ * # Visitor Methods
118
+ *
119
+ * Implement any combination of these optional async methods in your visitor:
120
+ * - `visitText(ctx, text) -> { type: string, output?: string }`
121
+ * - `visitLink(ctx, href, text, title) -> VisitResult`
122
+ * - `visitImage(ctx, src, alt, title) -> VisitResult`
123
+ * - `visitHeading(ctx, level, text, id) -> VisitResult`
124
+ * - `visitCodeBlock(ctx, lang, code) -> VisitResult`
125
+ * - `visitCodeInline(ctx, code) -> VisitResult`
126
+ * - `visitListItem(ctx, ordered, marker, text) -> VisitResult`
127
+ * - `visitTableRow(ctx, cells, isHeader) -> VisitResult`
128
+ * - `visitBlockquote(ctx, content, depth) -> VisitResult`
129
+ * - And 20+ more semantic and inline element callbacks
130
+ *
131
+ * # VisitResult Types
132
+ *
133
+ * Each callback should return an object with:
134
+ * - `type: 'continue' | 'skip' | 'custom' | 'preservehtml' | 'error'`
135
+ * - `output?: string` (required for 'custom' and 'error' types)
136
+ *
137
+ * # Arguments
138
+ *
139
+ * * `html` - The HTML string to convert
140
+ * * `options` - Optional conversion options
141
+ * * `visitor` - Visitor object with optional async callback methods
142
+ *
143
+ * # Example
144
+ *
145
+ * ```javascript
146
+ * const { convertWithVisitor } = require('html-to-markdown-node');
147
+ *
148
+ * const html = '<a href="https://example.com">Click me</a>';
149
+ * const visitor = {
150
+ * visitLink: async (ctx, href, text, title) => {
151
+ * console.log(`Found link: ${href}`);
152
+ * return { type: 'continue' }; // Use default markdown conversion
153
+ * }
154
+ * };
155
+ *
156
+ * const markdown = await convertWithVisitor(html, undefined, visitor);
157
+ * console.log(markdown); // [Click me](https://example.com)
158
+ * ```
159
+ */
160
+ export declare function convertWithVisitor(html: string, options: JsConversionOptions | undefined | null, visitor: object): string
161
+
110
162
  /** Create a reusable ConversionOptions handle. */
111
163
  export declare function createConversionOptionsHandle(options?: JsConversionOptions | undefined | null): ExternalObject<RustConversionOptions>
112
164
 
@@ -346,6 +398,21 @@ export declare const enum JsNewlineStyle {
346
398
  Backslash = 'Backslash'
347
399
  }
348
400
 
401
+ /**
402
+ * Convert HTML to Markdown
403
+ *
404
+ * # Arguments
405
+ */
406
+ export interface JsNodeContext {
407
+ nodeType: string
408
+ tagName: string
409
+ attributes: Record<string, string>
410
+ depth: number
411
+ indexInParent: number
412
+ parentTag?: string
413
+ isInline: boolean
414
+ }
415
+
349
416
  /** HTML preprocessing options */
350
417
  export interface JsPreprocessingOptions {
351
418
  /** Enable preprocessing */
@@ -372,6 +439,11 @@ export interface JsStructuredData {
372
439
  schema_type?: string
373
440
  }
374
441
 
442
+ export interface JsVisitResult {
443
+ type: string
444
+ output?: string
445
+ }
446
+
375
447
  /** Whitespace handling mode */
376
448
  export declare const enum JsWhitespaceMode {
377
449
  Normalized = 'Normalized',
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // prettier-ignore
2
2
  /* eslint-disable */
3
3
  // @ts-nocheck
4
+ /* auto-generated by NAPI-RS */
4
5
 
5
6
  const { readFileSync } = require('node:fs')
6
7
  let nativeBinding = null
@@ -54,6 +55,7 @@ const isMuslFromChildProcess = () => {
54
55
  try {
55
56
  return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
56
57
  } catch (e) {
58
+ // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
57
59
  return false
58
60
  }
59
61
  }
@@ -75,8 +77,8 @@ function requireNative() {
75
77
  try {
76
78
  const binding = require('html-to-markdown-node-android-arm64')
77
79
  const bindingPackageVersion = require('html-to-markdown-node-android-arm64/package.json').version
78
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
79
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
82
  }
81
83
  return binding
82
84
  } catch (e) {
@@ -91,8 +93,8 @@ function requireNative() {
91
93
  try {
92
94
  const binding = require('html-to-markdown-node-android-arm-eabi')
93
95
  const bindingPackageVersion = require('html-to-markdown-node-android-arm-eabi/package.json').version
94
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
95
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
98
  }
97
99
  return binding
98
100
  } catch (e) {
@@ -112,8 +114,8 @@ function requireNative() {
112
114
  try {
113
115
  const binding = require('html-to-markdown-node-win32-x64-gnu')
114
116
  const bindingPackageVersion = require('html-to-markdown-node-win32-x64-gnu/package.json').version
115
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
116
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
119
  }
118
120
  return binding
119
121
  } catch (e) {
@@ -128,8 +130,8 @@ function requireNative() {
128
130
  try {
129
131
  const binding = require('html-to-markdown-node-win32-x64-msvc')
130
132
  const bindingPackageVersion = require('html-to-markdown-node-win32-x64-msvc/package.json').version
131
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
132
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
135
  }
134
136
  return binding
135
137
  } catch (e) {
@@ -145,8 +147,8 @@ function requireNative() {
145
147
  try {
146
148
  const binding = require('html-to-markdown-node-win32-ia32-msvc')
147
149
  const bindingPackageVersion = require('html-to-markdown-node-win32-ia32-msvc/package.json').version
148
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
149
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
152
  }
151
153
  return binding
152
154
  } catch (e) {
@@ -161,8 +163,8 @@ function requireNative() {
161
163
  try {
162
164
  const binding = require('html-to-markdown-node-win32-arm64-msvc')
163
165
  const bindingPackageVersion = require('html-to-markdown-node-win32-arm64-msvc/package.json').version
164
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
165
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
168
  }
167
169
  return binding
168
170
  } catch (e) {
@@ -180,8 +182,8 @@ function requireNative() {
180
182
  try {
181
183
  const binding = require('html-to-markdown-node-darwin-universal')
182
184
  const bindingPackageVersion = require('html-to-markdown-node-darwin-universal/package.json').version
183
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
184
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
187
  }
186
188
  return binding
187
189
  } catch (e) {
@@ -196,8 +198,8 @@ function requireNative() {
196
198
  try {
197
199
  const binding = require('html-to-markdown-node-darwin-x64')
198
200
  const bindingPackageVersion = require('html-to-markdown-node-darwin-x64/package.json').version
199
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
200
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
203
  }
202
204
  return binding
203
205
  } catch (e) {
@@ -212,8 +214,8 @@ function requireNative() {
212
214
  try {
213
215
  const binding = require('html-to-markdown-node-darwin-arm64')
214
216
  const bindingPackageVersion = require('html-to-markdown-node-darwin-arm64/package.json').version
215
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
216
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
219
  }
218
220
  return binding
219
221
  } catch (e) {
@@ -232,8 +234,8 @@ function requireNative() {
232
234
  try {
233
235
  const binding = require('html-to-markdown-node-freebsd-x64')
234
236
  const bindingPackageVersion = require('html-to-markdown-node-freebsd-x64/package.json').version
235
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
236
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
239
  }
238
240
  return binding
239
241
  } catch (e) {
@@ -248,8 +250,8 @@ function requireNative() {
248
250
  try {
249
251
  const binding = require('html-to-markdown-node-freebsd-arm64')
250
252
  const bindingPackageVersion = require('html-to-markdown-node-freebsd-arm64/package.json').version
251
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
252
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
255
  }
254
256
  return binding
255
257
  } catch (e) {
@@ -269,8 +271,8 @@ function requireNative() {
269
271
  try {
270
272
  const binding = require('html-to-markdown-node-linux-x64-musl')
271
273
  const bindingPackageVersion = require('html-to-markdown-node-linux-x64-musl/package.json').version
272
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
273
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
276
  }
275
277
  return binding
276
278
  } catch (e) {
@@ -285,8 +287,8 @@ function requireNative() {
285
287
  try {
286
288
  const binding = require('html-to-markdown-node-linux-x64-gnu')
287
289
  const bindingPackageVersion = require('html-to-markdown-node-linux-x64-gnu/package.json').version
288
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
289
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
292
  }
291
293
  return binding
292
294
  } catch (e) {
@@ -303,8 +305,8 @@ function requireNative() {
303
305
  try {
304
306
  const binding = require('html-to-markdown-node-linux-arm64-musl')
305
307
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm64-musl/package.json').version
306
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
307
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
310
  }
309
311
  return binding
310
312
  } catch (e) {
@@ -319,8 +321,8 @@ function requireNative() {
319
321
  try {
320
322
  const binding = require('html-to-markdown-node-linux-arm64-gnu')
321
323
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm64-gnu/package.json').version
322
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
323
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
326
  }
325
327
  return binding
326
328
  } catch (e) {
@@ -337,8 +339,8 @@ function requireNative() {
337
339
  try {
338
340
  const binding = require('html-to-markdown-node-linux-arm-musleabihf')
339
341
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm-musleabihf/package.json').version
340
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
341
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
344
  }
343
345
  return binding
344
346
  } catch (e) {
@@ -353,8 +355,8 @@ function requireNative() {
353
355
  try {
354
356
  const binding = require('html-to-markdown-node-linux-arm-gnueabihf')
355
357
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm-gnueabihf/package.json').version
356
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
357
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
360
  }
359
361
  return binding
360
362
  } catch (e) {
@@ -371,8 +373,8 @@ function requireNative() {
371
373
  try {
372
374
  const binding = require('html-to-markdown-node-linux-loong64-musl')
373
375
  const bindingPackageVersion = require('html-to-markdown-node-linux-loong64-musl/package.json').version
374
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
375
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
378
  }
377
379
  return binding
378
380
  } catch (e) {
@@ -387,8 +389,8 @@ function requireNative() {
387
389
  try {
388
390
  const binding = require('html-to-markdown-node-linux-loong64-gnu')
389
391
  const bindingPackageVersion = require('html-to-markdown-node-linux-loong64-gnu/package.json').version
390
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
391
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
394
  }
393
395
  return binding
394
396
  } catch (e) {
@@ -405,8 +407,8 @@ function requireNative() {
405
407
  try {
406
408
  const binding = require('html-to-markdown-node-linux-riscv64-musl')
407
409
  const bindingPackageVersion = require('html-to-markdown-node-linux-riscv64-musl/package.json').version
408
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
409
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
412
  }
411
413
  return binding
412
414
  } catch (e) {
@@ -421,8 +423,8 @@ function requireNative() {
421
423
  try {
422
424
  const binding = require('html-to-markdown-node-linux-riscv64-gnu')
423
425
  const bindingPackageVersion = require('html-to-markdown-node-linux-riscv64-gnu/package.json').version
424
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
425
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
428
  }
427
429
  return binding
428
430
  } catch (e) {
@@ -438,8 +440,8 @@ function requireNative() {
438
440
  try {
439
441
  const binding = require('html-to-markdown-node-linux-ppc64-gnu')
440
442
  const bindingPackageVersion = require('html-to-markdown-node-linux-ppc64-gnu/package.json').version
441
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
442
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
445
  }
444
446
  return binding
445
447
  } catch (e) {
@@ -454,8 +456,8 @@ function requireNative() {
454
456
  try {
455
457
  const binding = require('html-to-markdown-node-linux-s390x-gnu')
456
458
  const bindingPackageVersion = require('html-to-markdown-node-linux-s390x-gnu/package.json').version
457
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
458
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
461
  }
460
462
  return binding
461
463
  } catch (e) {
@@ -474,8 +476,8 @@ function requireNative() {
474
476
  try {
475
477
  const binding = require('html-to-markdown-node-openharmony-arm64')
476
478
  const bindingPackageVersion = require('html-to-markdown-node-openharmony-arm64/package.json').version
477
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
478
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
481
  }
480
482
  return binding
481
483
  } catch (e) {
@@ -490,8 +492,8 @@ function requireNative() {
490
492
  try {
491
493
  const binding = require('html-to-markdown-node-openharmony-x64')
492
494
  const bindingPackageVersion = require('html-to-markdown-node-openharmony-x64/package.json').version
493
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
494
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
497
  }
496
498
  return binding
497
499
  } catch (e) {
@@ -506,8 +508,8 @@ function requireNative() {
506
508
  try {
507
509
  const binding = require('html-to-markdown-node-openharmony-arm')
508
510
  const bindingPackageVersion = require('html-to-markdown-node-openharmony-arm/package.json').version
509
- if (bindingPackageVersion !== '2.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
510
- throw new Error(`Native binding package version mismatch, expected 2.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '2.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 2.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
513
  }
512
514
  return binding
513
515
  } catch (e) {
@@ -572,17 +574,29 @@ if (!nativeBinding) {
572
574
  module.exports = nativeBinding
573
575
  module.exports.convert = nativeBinding.convert
574
576
  module.exports.convertBuffer = nativeBinding.convertBuffer
577
+ module.exports.convertBufferJson = nativeBinding.convertBufferJson
575
578
  module.exports.convertBufferWithOptionsHandle = nativeBinding.convertBufferWithOptionsHandle
576
579
  module.exports.convertInlineImagesBuffer = nativeBinding.convertInlineImagesBuffer
580
+ module.exports.convertInlineImagesBufferJson = nativeBinding.convertInlineImagesBufferJson
577
581
  module.exports.convertInlineImagesBufferWithOptionsHandle = nativeBinding.convertInlineImagesBufferWithOptionsHandle
582
+ module.exports.convertJson = nativeBinding.convertJson
578
583
  module.exports.convertWithInlineImages = nativeBinding.convertWithInlineImages
579
584
  module.exports.convertWithInlineImagesHandle = nativeBinding.convertWithInlineImagesHandle
585
+ module.exports.convertWithInlineImagesJson = nativeBinding.convertWithInlineImagesJson
580
586
  module.exports.convertWithMetadata = nativeBinding.convertWithMetadata
581
- module.exports.convertWithMetadataHandle = nativeBinding.convertWithMetadataHandle
582
587
  module.exports.convertWithMetadataBuffer = nativeBinding.convertWithMetadataBuffer
588
+ module.exports.convertWithMetadataBufferJson = nativeBinding.convertWithMetadataBufferJson
589
+ module.exports.convertWithMetadataBufferWithMetadataHandle = nativeBinding.convertWithMetadataBufferWithMetadataHandle
590
+ module.exports.convertWithMetadataBufferWithOptionsAndMetadataHandle = nativeBinding.convertWithMetadataBufferWithOptionsAndMetadataHandle
583
591
  module.exports.convertWithMetadataBufferWithOptionsHandle = nativeBinding.convertWithMetadataBufferWithOptionsHandle
592
+ module.exports.convertWithMetadataHandle = nativeBinding.convertWithMetadataHandle
593
+ module.exports.convertWithMetadataJson = nativeBinding.convertWithMetadataJson
584
594
  module.exports.convertWithOptionsHandle = nativeBinding.convertWithOptionsHandle
595
+ module.exports.convertWithVisitor = nativeBinding.convertWithVisitor
585
596
  module.exports.createConversionOptionsHandle = nativeBinding.createConversionOptionsHandle
597
+ module.exports.createConversionOptionsHandleJson = nativeBinding.createConversionOptionsHandleJson
598
+ module.exports.createMetadataConfigHandle = nativeBinding.createMetadataConfigHandle
599
+ module.exports.createMetadataConfigHandleJson = nativeBinding.createMetadataConfigHandleJson
586
600
  module.exports.JsCodeBlockStyle = nativeBinding.JsCodeBlockStyle
587
601
  module.exports.JsHeadingStyle = nativeBinding.JsHeadingStyle
588
602
  module.exports.JsHighlightStyle = nativeBinding.JsHighlightStyle
@@ -590,3 +604,5 @@ module.exports.JsListIndentType = nativeBinding.JsListIndentType
590
604
  module.exports.JsNewlineStyle = nativeBinding.JsNewlineStyle
591
605
  module.exports.JsPreprocessingPreset = nativeBinding.JsPreprocessingPreset
592
606
  module.exports.JsWhitespaceMode = nativeBinding.JsWhitespaceMode
607
+ module.exports.startProfiling = nativeBinding.startProfiling
608
+ module.exports.stopProfiling = nativeBinding.stopProfiling
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "html-to-markdown-node",
3
- "version": "2.16.0",
3
+ "version": "2.18.0",
4
4
  "description": "High-performance HTML to Markdown converter - Node.js native bindings",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
- "repository": "https://github.com/Goldziher/html-to-markdown",
8
- "homepage": "https://github.com/Goldziher/html-to-markdown",
7
+ "repository": "https://github.com/kreuzberg-dev/html-to-markdown",
8
+ "homepage": "https://github.com/kreuzberg-dev/html-to-markdown",
9
9
  "license": "MIT",
10
10
  "author": "Na'aman Hirschfeld <nhirschfeld@gmail.com>",
11
- "bugs": "https://github.com/Goldziher/html-to-markdown/issues",
11
+ "bugs": "https://github.com/kreuzberg-dev/html-to-markdown/issues",
12
12
  "keywords": [
13
13
  "html",
14
14
  "markdown",
@@ -70,14 +70,14 @@
70
70
  "up": "^1.0.2"
71
71
  },
72
72
  "optionalDependencies": {
73
- "html-to-markdown-node-darwin-x64": "2.16.0",
74
- "html-to-markdown-node-darwin-arm64": "2.16.0",
75
- "html-to-markdown-node-win32-x64-msvc": "2.16.0",
76
- "html-to-markdown-node-win32-arm64-msvc": "2.16.0",
77
- "html-to-markdown-node-linux-x64-gnu": "2.16.0",
78
- "html-to-markdown-node-linux-x64-musl": "2.16.0",
79
- "html-to-markdown-node-linux-arm64-gnu": "2.16.0",
80
- "html-to-markdown-node-linux-arm64-musl": "2.16.0",
81
- "html-to-markdown-node-linux-arm-gnueabihf": "2.16.0"
73
+ "html-to-markdown-node-darwin-x64": "2.18.0",
74
+ "html-to-markdown-node-darwin-arm64": "2.18.0",
75
+ "html-to-markdown-node-win32-x64-msvc": "2.18.0",
76
+ "html-to-markdown-node-win32-arm64-msvc": "2.18.0",
77
+ "html-to-markdown-node-linux-x64-gnu": "2.18.0",
78
+ "html-to-markdown-node-linux-x64-musl": "2.18.0",
79
+ "html-to-markdown-node-linux-arm64-gnu": "2.18.0",
80
+ "html-to-markdown-node-linux-arm64-musl": "2.18.0",
81
+ "html-to-markdown-node-linux-arm-gnueabihf": "2.18.0"
82
82
  }
83
83
  }