html-to-markdown-node 2.12.1 → 2.14.2

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/index.d.ts +102 -0
  2. package/index.js +54 -54
  3. package/package.json +23 -22
  4. package/LICENSE +0 -21
package/index.d.ts CHANGED
@@ -47,6 +47,32 @@ export declare function convertInlineImagesBuffer(html: Buffer, options?: JsConv
47
47
  */
48
48
  export declare function convertWithInlineImages(html: string, options?: JsConversionOptions | undefined | null, imageConfig?: JsInlineImageConfig | undefined | null): JsHtmlExtraction
49
49
 
50
+ /**
51
+ * Convert HTML to Markdown with metadata extraction.
52
+ *
53
+ * # Arguments
54
+ *
55
+ * * `html` - The HTML string to convert
56
+ * * `options` - Optional conversion options
57
+ * * `metadata_config` - Optional metadata extraction configuration
58
+ *
59
+ * # Example
60
+ *
61
+ * ```javascript
62
+ * const { convertWithMetadata } = require('html-to-markdown');
63
+ *
64
+ * const html = '<html lang="en"><head><title>Test</title></head><body><h1>Hello</h1></body></html>';
65
+ * const config = { extractHeaders: true, extractLinks: true };
66
+ * const result = convertWithMetadata(html, undefined, config);
67
+ * console.log(result.markdown);
68
+ * console.log(result.metadata.document.title);
69
+ * ```
70
+ */
71
+ export declare function convertWithMetadata(html: string, options?: JsConversionOptions | undefined | null, metadataConfig?: JsMetadataConfig | undefined | null): JsMetadataExtraction
72
+
73
+ /** Convert HTML from Buffer/Uint8Array with metadata extraction without intermediate string allocation. */
74
+ export declare function convertWithMetadataBuffer(html: Buffer, options?: JsConversionOptions | undefined | null, metadataConfig?: JsMetadataConfig | undefined | null): JsMetadataExtraction
75
+
50
76
  /** Convert HTML using a previously-created ConversionOptions handle. */
51
77
  export declare function convertWithOptionsHandle(html: string, options: ExternalObject<RustConversionOptions>): string
52
78
 
@@ -129,6 +155,39 @@ export interface JsConversionOptions {
129
155
  preserveTags?: Array<string>
130
156
  }
131
157
 
158
+ /** Document-level metadata */
159
+ export interface JsDocumentMetadata {
160
+ title?: string
161
+ description?: string
162
+ keywords: Array<string>
163
+ author?: string
164
+ canonical_url?: string
165
+ base_href?: string
166
+ language?: string
167
+ text_direction?: string
168
+ open_graph: Record<string, string>
169
+ twitter_card: Record<string, string>
170
+ meta_tags: Record<string, string>
171
+ }
172
+
173
+ /** Complete extracted metadata */
174
+ export interface JsExtendedMetadata {
175
+ document: JsDocumentMetadata
176
+ headers: Array<JsHeaderMetadata>
177
+ links: Array<JsLinkMetadata>
178
+ images: Array<JsImageMetadata>
179
+ structuredData: Array<JsStructuredData>
180
+ }
181
+
182
+ /** Header element metadata */
183
+ export interface JsHeaderMetadata {
184
+ level: number
185
+ text: string
186
+ id?: string
187
+ depth: number
188
+ html_offset: number
189
+ }
190
+
132
191
  /** Heading style options */
133
192
  export declare const enum JsHeadingStyle {
134
193
  /** Underlined style (=== for h1, --- for h2) */
@@ -161,6 +220,16 @@ export interface JsHtmlExtraction {
161
220
  warnings: Array<JsInlineImageWarning>
162
221
  }
163
222
 
223
+ /** Image metadata */
224
+ export interface JsImageMetadata {
225
+ src: string
226
+ alt?: string
227
+ title?: string
228
+ dimensions?: Array<number>
229
+ image_type: string
230
+ attributes: Record<string, string>
231
+ }
232
+
164
233
  /** Inline image data */
165
234
  export interface JsInlineImage {
166
235
  /** Raw image data */
@@ -199,12 +268,38 @@ export interface JsInlineImageWarning {
199
268
  message: string
200
269
  }
201
270
 
271
+ /** Hyperlink metadata */
272
+ export interface JsLinkMetadata {
273
+ href: string
274
+ text: string
275
+ title?: string
276
+ link_type: string
277
+ rel: Array<string>
278
+ attributes: Record<string, string>
279
+ }
280
+
202
281
  /** List indentation type */
203
282
  export declare const enum JsListIndentType {
204
283
  Spaces = 'Spaces',
205
284
  Tabs = 'Tabs'
206
285
  }
207
286
 
287
+ /** Metadata extraction configuration */
288
+ export interface JsMetadataConfig {
289
+ extract_document?: boolean
290
+ extract_headers?: boolean
291
+ extract_links?: boolean
292
+ extract_images?: boolean
293
+ extract_structured_data?: boolean
294
+ max_structured_data_size?: number
295
+ }
296
+
297
+ /** Result of conversion with metadata extraction */
298
+ export interface JsMetadataExtraction {
299
+ markdown: string
300
+ metadata: JsExtendedMetadata
301
+ }
302
+
208
303
  /** Newline style */
209
304
  export declare const enum JsNewlineStyle {
210
305
  /** Two spaces at end of line */
@@ -232,6 +327,13 @@ export declare const enum JsPreprocessingPreset {
232
327
  Aggressive = 'Aggressive'
233
328
  }
234
329
 
330
+ /** Structured data (JSON-LD, Microdata, RDFa) */
331
+ export interface JsStructuredData {
332
+ data_type: string
333
+ raw_json: string
334
+ schema_type?: string
335
+ }
336
+
235
337
  /** Whitespace handling mode */
236
338
  export declare const enum JsWhitespaceMode {
237
339
  Normalized = 'Normalized',
package/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // prettier-ignore
2
2
  /* eslint-disable */
3
3
  // @ts-nocheck
4
- /* auto-generated by NAPI-RS */
5
4
 
6
5
  const { readFileSync } = require('node:fs')
7
6
  let nativeBinding = null
@@ -55,7 +54,6 @@ const isMuslFromChildProcess = () => {
55
54
  try {
56
55
  return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
57
56
  } 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
59
57
  return false
60
58
  }
61
59
  }
@@ -77,8 +75,8 @@ function requireNative() {
77
75
  try {
78
76
  const binding = require('html-to-markdown-node-android-arm64')
79
77
  const bindingPackageVersion = require('html-to-markdown-node-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
78
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
80
  }
83
81
  return binding
84
82
  } catch (e) {
@@ -93,8 +91,8 @@ function requireNative() {
93
91
  try {
94
92
  const binding = require('html-to-markdown-node-android-arm-eabi')
95
93
  const bindingPackageVersion = require('html-to-markdown-node-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
94
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
96
  }
99
97
  return binding
100
98
  } catch (e) {
@@ -114,8 +112,8 @@ function requireNative() {
114
112
  try {
115
113
  const binding = require('html-to-markdown-node-win32-x64-gnu')
116
114
  const bindingPackageVersion = require('html-to-markdown-node-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
115
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
117
  }
120
118
  return binding
121
119
  } catch (e) {
@@ -130,8 +128,8 @@ function requireNative() {
130
128
  try {
131
129
  const binding = require('html-to-markdown-node-win32-x64-msvc')
132
130
  const bindingPackageVersion = require('html-to-markdown-node-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
133
  }
136
134
  return binding
137
135
  } catch (e) {
@@ -147,8 +145,8 @@ function requireNative() {
147
145
  try {
148
146
  const binding = require('html-to-markdown-node-win32-ia32-msvc')
149
147
  const bindingPackageVersion = require('html-to-markdown-node-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
148
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
150
  }
153
151
  return binding
154
152
  } catch (e) {
@@ -163,8 +161,8 @@ function requireNative() {
163
161
  try {
164
162
  const binding = require('html-to-markdown-node-win32-arm64-msvc')
165
163
  const bindingPackageVersion = require('html-to-markdown-node-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
164
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
166
  }
169
167
  return binding
170
168
  } catch (e) {
@@ -182,8 +180,8 @@ function requireNative() {
182
180
  try {
183
181
  const binding = require('html-to-markdown-node-darwin-universal')
184
182
  const bindingPackageVersion = require('html-to-markdown-node-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
185
  }
188
186
  return binding
189
187
  } catch (e) {
@@ -198,8 +196,8 @@ function requireNative() {
198
196
  try {
199
197
  const binding = require('html-to-markdown-node-darwin-x64')
200
198
  const bindingPackageVersion = require('html-to-markdown-node-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
199
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
201
  }
204
202
  return binding
205
203
  } catch (e) {
@@ -214,8 +212,8 @@ function requireNative() {
214
212
  try {
215
213
  const binding = require('html-to-markdown-node-darwin-arm64')
216
214
  const bindingPackageVersion = require('html-to-markdown-node-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
215
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
217
  }
220
218
  return binding
221
219
  } catch (e) {
@@ -234,8 +232,8 @@ function requireNative() {
234
232
  try {
235
233
  const binding = require('html-to-markdown-node-freebsd-x64')
236
234
  const bindingPackageVersion = require('html-to-markdown-node-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
235
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
237
  }
240
238
  return binding
241
239
  } catch (e) {
@@ -250,8 +248,8 @@ function requireNative() {
250
248
  try {
251
249
  const binding = require('html-to-markdown-node-freebsd-arm64')
252
250
  const bindingPackageVersion = require('html-to-markdown-node-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
251
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
253
  }
256
254
  return binding
257
255
  } catch (e) {
@@ -271,8 +269,8 @@ function requireNative() {
271
269
  try {
272
270
  const binding = require('html-to-markdown-node-linux-x64-musl')
273
271
  const bindingPackageVersion = require('html-to-markdown-node-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
272
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
274
  }
277
275
  return binding
278
276
  } catch (e) {
@@ -287,8 +285,8 @@ function requireNative() {
287
285
  try {
288
286
  const binding = require('html-to-markdown-node-linux-x64-gnu')
289
287
  const bindingPackageVersion = require('html-to-markdown-node-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
290
  }
293
291
  return binding
294
292
  } catch (e) {
@@ -305,8 +303,8 @@ function requireNative() {
305
303
  try {
306
304
  const binding = require('html-to-markdown-node-linux-arm64-musl')
307
305
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
306
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
308
  }
311
309
  return binding
312
310
  } catch (e) {
@@ -321,8 +319,8 @@ function requireNative() {
321
319
  try {
322
320
  const binding = require('html-to-markdown-node-linux-arm64-gnu')
323
321
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
322
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
324
  }
327
325
  return binding
328
326
  } catch (e) {
@@ -339,8 +337,8 @@ function requireNative() {
339
337
  try {
340
338
  const binding = require('html-to-markdown-node-linux-arm-musleabihf')
341
339
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
340
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
342
  }
345
343
  return binding
346
344
  } catch (e) {
@@ -355,8 +353,8 @@ function requireNative() {
355
353
  try {
356
354
  const binding = require('html-to-markdown-node-linux-arm-gnueabihf')
357
355
  const bindingPackageVersion = require('html-to-markdown-node-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
356
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
358
  }
361
359
  return binding
362
360
  } catch (e) {
@@ -373,8 +371,8 @@ function requireNative() {
373
371
  try {
374
372
  const binding = require('html-to-markdown-node-linux-loong64-musl')
375
373
  const bindingPackageVersion = require('html-to-markdown-node-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
374
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
376
  }
379
377
  return binding
380
378
  } catch (e) {
@@ -389,8 +387,8 @@ function requireNative() {
389
387
  try {
390
388
  const binding = require('html-to-markdown-node-linux-loong64-gnu')
391
389
  const bindingPackageVersion = require('html-to-markdown-node-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
390
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
392
  }
395
393
  return binding
396
394
  } catch (e) {
@@ -407,8 +405,8 @@ function requireNative() {
407
405
  try {
408
406
  const binding = require('html-to-markdown-node-linux-riscv64-musl')
409
407
  const bindingPackageVersion = require('html-to-markdown-node-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
408
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
410
  }
413
411
  return binding
414
412
  } catch (e) {
@@ -423,8 +421,8 @@ function requireNative() {
423
421
  try {
424
422
  const binding = require('html-to-markdown-node-linux-riscv64-gnu')
425
423
  const bindingPackageVersion = require('html-to-markdown-node-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
424
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
426
  }
429
427
  return binding
430
428
  } catch (e) {
@@ -440,8 +438,8 @@ function requireNative() {
440
438
  try {
441
439
  const binding = require('html-to-markdown-node-linux-ppc64-gnu')
442
440
  const bindingPackageVersion = require('html-to-markdown-node-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
441
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
443
  }
446
444
  return binding
447
445
  } catch (e) {
@@ -456,8 +454,8 @@ function requireNative() {
456
454
  try {
457
455
  const binding = require('html-to-markdown-node-linux-s390x-gnu')
458
456
  const bindingPackageVersion = require('html-to-markdown-node-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
457
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
459
  }
462
460
  return binding
463
461
  } catch (e) {
@@ -476,8 +474,8 @@ function requireNative() {
476
474
  try {
477
475
  const binding = require('html-to-markdown-node-openharmony-arm64')
478
476
  const bindingPackageVersion = require('html-to-markdown-node-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
477
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
479
  }
482
480
  return binding
483
481
  } catch (e) {
@@ -492,8 +490,8 @@ function requireNative() {
492
490
  try {
493
491
  const binding = require('html-to-markdown-node-openharmony-x64')
494
492
  const bindingPackageVersion = require('html-to-markdown-node-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
493
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
495
  }
498
496
  return binding
499
497
  } catch (e) {
@@ -508,8 +506,8 @@ function requireNative() {
508
506
  try {
509
507
  const binding = require('html-to-markdown-node-openharmony-arm')
510
508
  const bindingPackageVersion = require('html-to-markdown-node-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '2.12.1' && 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.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
509
+ if (bindingPackageVersion !== '2.14.2' && 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.14.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
511
  }
514
512
  return binding
515
513
  } catch (e) {
@@ -577,6 +575,8 @@ module.exports.convertBuffer = nativeBinding.convertBuffer
577
575
  module.exports.convertBufferWithOptionsHandle = nativeBinding.convertBufferWithOptionsHandle
578
576
  module.exports.convertInlineImagesBuffer = nativeBinding.convertInlineImagesBuffer
579
577
  module.exports.convertWithInlineImages = nativeBinding.convertWithInlineImages
578
+ module.exports.convertWithMetadata = nativeBinding.convertWithMetadata
579
+ module.exports.convertWithMetadataBuffer = nativeBinding.convertWithMetadataBuffer
580
580
  module.exports.convertWithOptionsHandle = nativeBinding.convertWithOptionsHandle
581
581
  module.exports.createConversionOptionsHandle = nativeBinding.createConversionOptionsHandle
582
582
  module.exports.JsCodeBlockStyle = nativeBinding.JsCodeBlockStyle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-to-markdown-node",
3
- "version": "2.12.1",
3
+ "version": "2.14.2",
4
4
  "description": "High-performance HTML to Markdown converter - Node.js native bindings",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -45,9 +45,21 @@
45
45
  "registry": "https://registry.npmjs.org/",
46
46
  "access": "public"
47
47
  },
48
+ "scripts": {
49
+ "artifacts": "napi artifacts",
50
+ "build": "napi build --platform --release",
51
+ "build:debug": "napi build --platform",
52
+ "prepublishOnly": "napi prepublish -t npm",
53
+ "test": "vitest run",
54
+ "test:watch": "vitest",
55
+ "test:simple": "node test.js",
56
+ "universal": "napi universal",
57
+ "version": "napi version",
58
+ "clean": "rm -rf dist node_modules *.node"
59
+ },
48
60
  "devDependencies": {
49
61
  "@napi-rs/cli": "^3.5.0",
50
- "@types/node": "^24.10.2",
62
+ "@types/node": "^25.0.1",
51
63
  "tsx": "^4.21.0",
52
64
  "vitest": "^4.0.15"
53
65
  },
@@ -58,25 +70,14 @@
58
70
  "up": "^1.0.2"
59
71
  },
60
72
  "optionalDependencies": {
61
- "html-to-markdown-node-darwin-x64": "2.12.1",
62
- "html-to-markdown-node-darwin-arm64": "2.12.1",
63
- "html-to-markdown-node-win32-x64-msvc": "2.12.1",
64
- "html-to-markdown-node-win32-arm64-msvc": "2.12.1",
65
- "html-to-markdown-node-linux-x64-gnu": "2.12.1",
66
- "html-to-markdown-node-linux-x64-musl": "2.12.1",
67
- "html-to-markdown-node-linux-arm64-gnu": "2.12.1",
68
- "html-to-markdown-node-linux-arm64-musl": "2.12.1",
69
- "html-to-markdown-node-linux-arm-gnueabihf": "2.12.1"
70
- },
71
- "scripts": {
72
- "artifacts": "napi artifacts",
73
- "build": "napi build --platform --release",
74
- "build:debug": "napi build --platform",
75
- "test": "vitest run",
76
- "test:watch": "vitest",
77
- "test:simple": "node test.js",
78
- "universal": "napi universal",
79
- "version": "napi version",
80
- "clean": "rm -rf dist node_modules *.node"
73
+ "html-to-markdown-node-darwin-x64": "2.14.2",
74
+ "html-to-markdown-node-darwin-arm64": "2.14.2",
75
+ "html-to-markdown-node-win32-x64-msvc": "2.14.2",
76
+ "html-to-markdown-node-win32-arm64-msvc": "2.14.2",
77
+ "html-to-markdown-node-linux-x64-gnu": "2.14.2",
78
+ "html-to-markdown-node-linux-x64-musl": "2.14.2",
79
+ "html-to-markdown-node-linux-arm64-gnu": "2.14.2",
80
+ "html-to-markdown-node-linux-arm64-musl": "2.14.2",
81
+ "html-to-markdown-node-linux-arm-gnueabihf": "2.14.2"
81
82
  }
82
83
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright 2024-2025 Na'aman Hirschfeld
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.