@everruns/markkit 0.1.1 → 0.2.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
@@ -1,6 +1,6 @@
1
1
  # @everruns/markkit
2
2
 
3
- Native Node.js bindings for Markkit HTML-to-Markdown extraction.
3
+ Native Node.js bindings for Markkit: HTML, PDF, DOCX and spreadsheets to Markdown.
4
4
 
5
5
  This npm release supports **Linux x64 with glibc**. It does not include binaries for
6
6
  macOS, Windows, ARM64 or musl Linux. Other platforms require a separate future
@@ -15,3 +15,74 @@ const { extractHtmlSync } = require('@everruns/markkit');
15
15
  console.log(extractHtmlSync('<h1>Hello</h1>'));
16
16
  // # Hello
17
17
  ```
18
+
19
+ ## Options
20
+
21
+ Every function takes an optional trailing options object:
22
+
23
+ ```js
24
+ const { extractHtml, extractUrl, extractDocumentSync } = require('@everruns/markkit');
25
+
26
+ await extractHtml(html, { includeSelectors: ['article'], excludeSelectors: ['.ad'], preserveImages: false });
27
+
28
+ // URLs: non-public addresses are blocked by default.
29
+ await extractUrl('https://docs.example.com/page', { allowedHosts: ['docs.example.com'], maxRedirects: 2 });
30
+
31
+ // Documents with metadata (HTML, PDF, DOCX, PPTX, XLSX/XLSB/XLS/ODS). `warnings` are `{ code, detail }`.
32
+ const doc = extractDocumentSync(fs.readFileSync('report.docx'), { fileName: 'report.docx' }, { maxSheetRows: 500 });
33
+ console.log(doc.title, doc.format, doc.warnings, doc.markdown);
34
+ ```
35
+
36
+ Fields: `maxInputSize`, `maxOutputSize`, `timeout` (seconds, covers fetch, parsing and
37
+ rendering; `maxProcessingSecs` is the whole-second form), `maxNodes`, `maxNestingDepth`,
38
+ `baseUrl`, `mainContent`, `pdfLayout`, `preserveLinks`, `preserveImages`,
39
+ `includeSelectors`, `excludeSelectors` (added to the defaults), `maxArchiveEntries`,
40
+ `maxArchiveEntrySize`, `maxArchiveTotalSize`, `maxSheetRows`, `maxSheetCols`,
41
+ `maxSpreadsheetCells`, `includeHiddenSheets`, `allowPrivateNetworks` (trusted URLs only),
42
+ `allowedHosts`, `maxRedirects`, `maxPdfPages`, `maxPdfStreamSize`, `maxPdfDecodedSize`.
43
+
44
+ For browsers and edge runtimes use [`@everruns/markkit-wasm`](https://www.npmjs.com/package/@everruns/markkit-wasm).
45
+
46
+ ## PDF layout and tables
47
+
48
+ PDF text extraction reconstructs columns, ruled and conservative borderless tables,
49
+ including merged and wrapped cells. Tagged headings/ActualText, bold/italic and
50
+ numbered lists are preserved. Set `pdfRemoveRepeatedHeaders: true` to suppress
51
+ repeated margin headers/footers.
52
+
53
+ `pdfLayout: true` adds `layout: { version: 1, pages }` to document results. Source
54
+ `spans` retain drawing order and include glyph-positioned `words`. Semantic `blocks`
55
+ are in reading order, with `id`, `kind`, `bbox`, `spanIds`, `lines` and table `cells`.
56
+ Cells have row/column positions, rowspan/colspan and source references. Coordinates
57
+ are display points from the cropped/rotated top-left, x right and y down. Font
58
+ bounds approximate an em box. Layout is optional and does not change Markdown.
59
+
60
+ Node and WASM use camelCase keys. `maxNodes` bounds primitives and geometry;
61
+ `maxPdfDecodedSize` bounds retained geometry and analysis work; table row/column/
62
+ grid limits apply. `maxOutputSize` independently bounds compact layout JSON and
63
+ Markdown, excluding JSON wrapper/pretty-print overhead.
64
+
65
+ Native OCR: install Tesseract plus language data. Use
66
+ `{ pdfOcr: true, pdfOcrLanguage: "eng", timeout: 300 }` on `extractDocumentSync` /
67
+ `extractDocument`. Only textless pages are recognized. OCR word bounds are returned
68
+ in layout; helpers use private files, bounded dimensions/output and the deadline.
69
+
70
+ ## Optional Rust OCR backend
71
+
72
+ Source builds can enable `markkit-js`'s Cargo feature `pdf-ocr-ocrs`. Default npm
73
+ builds retain Tesseract. Prepare the pinned models from the repository with
74
+ `python3 scripts/prepare_ocr_models.py`, then configure:
75
+
76
+ ```js
77
+ extractDocumentSync(bytes, { fileName: "scan.pdf" }, {
78
+ pdfOcr: true, pdfOcrBackend: "ocrs", timeout: 300,
79
+ pdfOcrDetectionModel: "/models/text-detection.onnx",
80
+ pdfOcrRecognitionModel: "/models/text-recognition.onnx"
81
+ });
82
+ ```
83
+
84
+ Models load from explicit local paths only. The pinned weights use CC-BY-SA 4.0
85
+ and carry attribution in the setup script's NOTICE.json. The current Latin
86
+ model accepts `pdfOcrLanguage: "eng"`. Missing build features/models and other
87
+ languages fail explicitly. Model files and inference need trusted deployment
88
+ configuration and host CPU/memory quotas; inference deadlines are cooperative.
package/index.d.ts CHANGED
@@ -9,14 +9,186 @@
9
9
  */
10
10
  export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
11
 
12
+ /** Format hints for `extractDocument`. */
13
+ export interface DocumentHint {
14
+ /** MIME type, e.g. from a `Content-Type` header. */
15
+ contentType?: string
16
+ /** File name or URL path; only the extension is used. */
17
+ fileName?: string
18
+ }
19
+
12
20
  /** Extract markdown from a buffer with optional content type. */
13
- export declare function extractBytes(data: Buffer, contentType?: string | undefined | null): Promise<string>
21
+ export declare function extractBytes(data: Buffer, contentType?: string | undefined | null, options?: MarkkitOptions | undefined | null): Promise<string>
22
+
23
+ /** Convert a document (HTML, DOCX, XLSX/XLS/ODS) with metadata (async). */
24
+ export declare function extractDocument(data: Buffer, hint?: DocumentHint | undefined | null, options?: MarkkitOptions | undefined | null): Promise<Extraction>
25
+
26
+ /** Convert a document (HTML, DOCX, XLSX/XLS/ODS) with metadata (synchronous). */
27
+ export declare function extractDocumentSync(data: Buffer, hint?: DocumentHint | undefined | null, options?: MarkkitOptions | undefined | null): Extraction
14
28
 
15
29
  /** Extract markdown from an HTML string (async). */
16
- export declare function extractHtml(html: string): Promise<string>
30
+ export declare function extractHtml(html: string, options?: MarkkitOptions | undefined | null): Promise<string>
17
31
 
18
32
  /** Extract markdown from an HTML string (synchronous). */
19
- export declare function extractHtmlSync(html: string): string
33
+ export declare function extractHtmlSync(html: string, options?: MarkkitOptions | undefined | null): string
34
+
35
+ /** Markdown plus metadata. */
36
+ export interface Extraction {
37
+ layout?: PdfLayout
38
+ markdown: string
39
+ title?: string
40
+ /** Detected format (`html`, `docx`, `pptx`, `xlsx`, `xlsb`, `xls`, `ods`, `text`, `markdown`, `csv`, `tsv`, `ipynb`, `eml`, `odt`, `epub`). */
41
+ format: string
42
+ warnings: Array<Warning>
43
+ stats: ExtractionStats
44
+ metadata: Metadata
45
+ }
46
+
47
+ export interface ExtractionStats {
48
+ pages?: number
49
+ sheets?: number
50
+ rows?: number
51
+ paragraphs?: number
52
+ tables?: number
53
+ }
54
+
55
+ /**
56
+ * Extract markdown from a URL. Non-public addresses are refused unless
57
+ * `allowPrivateNetworks` is set.
58
+ */
59
+ export declare function extractUrl(url: string, options?: MarkkitOptions | undefined | null): Promise<string>
60
+
61
+ /** Extraction options; every field is optional and defaults to the Rust builder. */
62
+ export interface MarkkitOptions {
63
+ /** Maximum input size in bytes (default 50 MiB). */
64
+ maxInputSize?: number
65
+ /** Wall-clock budget per call in whole seconds (default 60). Prefer `timeout`. */
66
+ maxProcessingSecs?: number
67
+ /**
68
+ * Wall-clock budget per call in seconds, fractions allowed (default 60);
69
+ * covers URL fetch, parsing and rendering. Wins over `maxProcessingSecs`.
70
+ */
71
+ timeout?: number
72
+ /** Maximum Markdown output in bytes (default 128 MiB). */
73
+ maxOutputSize?: number
74
+ /** Maximum parsed nodes (default 5 000 000). */
75
+ maxNodes?: number
76
+ /** Maximum element nesting (default 256, capped at 512). */
77
+ maxNestingDepth?: number
78
+ /**
79
+ * Absolute URL relative links and images resolve against (`extractUrl`
80
+ * uses the final response URL).
81
+ */
82
+ baseUrl?: string
83
+ /** Keep only the detected main content (article body) of HTML pages. */
84
+ mainContent?: boolean
85
+ /** Retain PDF page dimensions and positioned text runs in `Extraction.layout`. */
86
+ pdfLayout?: boolean
87
+ pdfRemoveRepeatedHeaders?: boolean
88
+ pdfOcr?: boolean
89
+ pdfOcrLanguage?: string
90
+ pdfOcrBackend?: string
91
+ pdfOcrDetectionModel?: string
92
+ pdfOcrRecognitionModel?: string
93
+ preserveLinks?: boolean
94
+ preserveImages?: boolean
95
+ /** CSS selectors to include (empty = whole document). */
96
+ includeSelectors?: Array<string>
97
+ /** CSS selectors to drop, added to nav/footer/header/script/style/noscript. */
98
+ excludeSelectors?: Array<string>
99
+ maxArchiveEntries?: number
100
+ maxArchiveEntrySize?: number
101
+ maxArchiveTotalSize?: number
102
+ maxSheetRows?: number
103
+ maxSheetCols?: number
104
+ maxSpreadsheetCells?: number
105
+ includeHiddenSheets?: boolean
106
+ /** Let `extractUrl` reach loopback/private/link-local addresses. Trusted URLs only. */
107
+ allowPrivateNetworks?: boolean
108
+ /** Hosts `extractUrl` may contact (checked on every redirect). */
109
+ allowedHosts?: Array<string>
110
+ /** Maximum redirects `extractUrl` follows (default 5). */
111
+ maxRedirects?: number
112
+ maxPdfPages?: number
113
+ maxPdfStreamSize?: number
114
+ maxPdfDecodedSize?: number
115
+ }
116
+
117
+ /** Document metadata (HTML meta, Open Graph, JSON-LD); fields absent when unknown. */
118
+ export interface Metadata {
119
+ description?: string
120
+ author?: string
121
+ published?: string
122
+ language?: string
123
+ canonicalUrl?: string
124
+ siteName?: string
125
+ image?: string
126
+ }
127
+
128
+ export interface PdfBlock {
129
+ id: number
130
+ kind: string
131
+ bbox: Array<number>
132
+ spanIds: Array<number>
133
+ lines: Array<PdfLine>
134
+ cells: Array<PdfCell>
135
+ }
136
+
137
+ export interface PdfCell {
138
+ row: number
139
+ column: number
140
+ rowspan: number
141
+ colspan: number
142
+ bbox: Array<number>
143
+ spanIds: Array<number>
144
+ }
145
+
146
+ /** PDF source geometry; coordinates are display points, x right and y down. */
147
+ export interface PdfLayout {
148
+ version: number
149
+ pages: Array<PdfPageLayout>
150
+ }
151
+
152
+ export interface PdfLine {
153
+ bbox: Array<number>
154
+ spanIds: Array<number>
155
+ }
156
+
157
+ export interface PdfPageLayout {
158
+ page: number
159
+ width: number
160
+ height: number
161
+ rotation: number
162
+ spans: Array<PdfTextSpan>
163
+ blocks: Array<PdfBlock>
164
+ }
165
+
166
+ export interface PdfTextSpan {
167
+ id: number
168
+ text: string
169
+ /** Approximate em bounds: [left, top, right, bottom]. */
170
+ bbox: Array<number>
171
+ baseline: Array<Array<number>>
172
+ font?: string
173
+ size: number
174
+ angle: number
175
+ words: Array<PdfWord>
176
+ bold: boolean
177
+ italic: boolean
178
+ role?: string
179
+ ocr: boolean
180
+ }
181
+
182
+ export interface PdfWord {
183
+ text: string
184
+ bbox: Array<number>
185
+ baseline: Array<Array<number>>
186
+ }
20
187
 
21
- /** Extract markdown from a URL. */
22
- export declare function extractUrl(url: string): Promise<string>
188
+ /** Structured extraction warning. */
189
+ export interface Warning {
190
+ /** Stable machine code (`truncated_sheet`, `hidden_slide_skipped`, ...). */
191
+ code: string
192
+ /** Human-readable detail. */
193
+ detail: string
194
+ }
package/index.js CHANGED
@@ -94,8 +94,8 @@ function requireNative() {
94
94
  try {
95
95
  const binding = require('@everruns/markkit-android-arm64')
96
96
  const bindingPackageVersion = require('@everruns/markkit-android-arm64/package.json').version
97
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
98
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
97
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
98
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
99
99
  }
100
100
  return binding
101
101
  } catch (e) {
@@ -110,8 +110,8 @@ function requireNative() {
110
110
  try {
111
111
  const binding = require('@everruns/markkit-android-arm-eabi')
112
112
  const bindingPackageVersion = require('@everruns/markkit-android-arm-eabi/package.json').version
113
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
113
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
115
115
  }
116
116
  return binding
117
117
  } catch (e) {
@@ -131,8 +131,8 @@ function requireNative() {
131
131
  try {
132
132
  const binding = require('@everruns/markkit-win32-x64-gnu')
133
133
  const bindingPackageVersion = require('@everruns/markkit-win32-x64-gnu/package.json').version
134
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
135
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
135
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
136
  }
137
137
  return binding
138
138
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@everruns/markkit-win32-x64-msvc')
149
149
  const bindingPackageVersion = require('@everruns/markkit-win32-x64-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.1.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 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.2.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 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -164,8 +164,8 @@ function requireNative() {
164
164
  try {
165
165
  const binding = require('@everruns/markkit-win32-ia32-msvc')
166
166
  const bindingPackageVersion = require('@everruns/markkit-win32-ia32-msvc/package.json').version
167
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
168
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
168
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
169
169
  }
170
170
  return binding
171
171
  } catch (e) {
@@ -180,8 +180,8 @@ function requireNative() {
180
180
  try {
181
181
  const binding = require('@everruns/markkit-win32-arm64-msvc')
182
182
  const bindingPackageVersion = require('@everruns/markkit-win32-arm64-msvc/package.json').version
183
- if (bindingPackageVersion !== '0.1.1' && 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 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
+ if (bindingPackageVersion !== '0.2.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 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
185
  }
186
186
  return binding
187
187
  } catch (e) {
@@ -199,8 +199,8 @@ function requireNative() {
199
199
  try {
200
200
  const binding = require('@everruns/markkit-darwin-universal')
201
201
  const bindingPackageVersion = require('@everruns/markkit-darwin-universal/package.json').version
202
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
204
  }
205
205
  return binding
206
206
  } catch (e) {
@@ -215,8 +215,8 @@ function requireNative() {
215
215
  try {
216
216
  const binding = require('@everruns/markkit-darwin-x64')
217
217
  const bindingPackageVersion = require('@everruns/markkit-darwin-x64/package.json').version
218
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
219
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
219
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
220
220
  }
221
221
  return binding
222
222
  } catch (e) {
@@ -231,8 +231,8 @@ function requireNative() {
231
231
  try {
232
232
  const binding = require('@everruns/markkit-darwin-arm64')
233
233
  const bindingPackageVersion = require('@everruns/markkit-darwin-arm64/package.json').version
234
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
235
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
234
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
235
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
236
236
  }
237
237
  return binding
238
238
  } catch (e) {
@@ -251,8 +251,8 @@ function requireNative() {
251
251
  try {
252
252
  const binding = require('@everruns/markkit-freebsd-x64')
253
253
  const bindingPackageVersion = require('@everruns/markkit-freebsd-x64/package.json').version
254
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
256
256
  }
257
257
  return binding
258
258
  } catch (e) {
@@ -267,8 +267,8 @@ function requireNative() {
267
267
  try {
268
268
  const binding = require('@everruns/markkit-freebsd-arm64')
269
269
  const bindingPackageVersion = require('@everruns/markkit-freebsd-arm64/package.json').version
270
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
270
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
272
272
  }
273
273
  return binding
274
274
  } catch (e) {
@@ -283,8 +283,8 @@ function requireNative() {
283
283
  try {
284
284
  const binding = require('@everruns/markkit-freebsd-ppc64')
285
285
  const bindingPackageVersion = require('@everruns/markkit-freebsd-ppc64/package.json').version
286
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
288
  }
289
289
  return binding
290
290
  } catch (e) {
@@ -304,8 +304,8 @@ function requireNative() {
304
304
  try {
305
305
  const binding = require('@everruns/markkit-linux-x64-musl')
306
306
  const bindingPackageVersion = require('@everruns/markkit-linux-x64-musl/package.json').version
307
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
307
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
309
309
  }
310
310
  return binding
311
311
  } catch (e) {
@@ -320,8 +320,8 @@ function requireNative() {
320
320
  try {
321
321
  const binding = require('@everruns/markkit-linux-x64-gnu')
322
322
  const bindingPackageVersion = require('@everruns/markkit-linux-x64-gnu/package.json').version
323
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
323
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
325
325
  }
326
326
  return binding
327
327
  } catch (e) {
@@ -338,8 +338,8 @@ function requireNative() {
338
338
  try {
339
339
  const binding = require('@everruns/markkit-linux-arm64-musl')
340
340
  const bindingPackageVersion = require('@everruns/markkit-linux-arm64-musl/package.json').version
341
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
341
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
343
343
  }
344
344
  return binding
345
345
  } catch (e) {
@@ -354,8 +354,8 @@ function requireNative() {
354
354
  try {
355
355
  const binding = require('@everruns/markkit-linux-arm64-gnu')
356
356
  const bindingPackageVersion = require('@everruns/markkit-linux-arm64-gnu/package.json').version
357
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
357
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
359
359
  }
360
360
  return binding
361
361
  } catch (e) {
@@ -372,8 +372,8 @@ function requireNative() {
372
372
  try {
373
373
  const binding = require('@everruns/markkit-linux-arm-musleabihf')
374
374
  const bindingPackageVersion = require('@everruns/markkit-linux-arm-musleabihf/package.json').version
375
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
375
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
377
377
  }
378
378
  return binding
379
379
  } catch (e) {
@@ -388,8 +388,8 @@ function requireNative() {
388
388
  try {
389
389
  const binding = require('@everruns/markkit-linux-arm-gnueabihf')
390
390
  const bindingPackageVersion = require('@everruns/markkit-linux-arm-gnueabihf/package.json').version
391
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
391
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
393
393
  }
394
394
  return binding
395
395
  } catch (e) {
@@ -406,8 +406,8 @@ function requireNative() {
406
406
  try {
407
407
  const binding = require('@everruns/markkit-linux-loong64-musl')
408
408
  const bindingPackageVersion = require('@everruns/markkit-linux-loong64-musl/package.json').version
409
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
409
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
411
  }
412
412
  return binding
413
413
  } catch (e) {
@@ -422,8 +422,8 @@ function requireNative() {
422
422
  try {
423
423
  const binding = require('@everruns/markkit-linux-loong64-gnu')
424
424
  const bindingPackageVersion = require('@everruns/markkit-linux-loong64-gnu/package.json').version
425
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
425
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
427
427
  }
428
428
  return binding
429
429
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@everruns/markkit-linux-riscv64-musl')
442
442
  const bindingPackageVersion = require('@everruns/markkit-linux-riscv64-musl/package.json').version
443
- if (bindingPackageVersion !== '0.1.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 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.2.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 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@everruns/markkit-linux-riscv64-gnu')
458
458
  const bindingPackageVersion = require('@everruns/markkit-linux-riscv64-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.1.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 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.2.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 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -473,8 +473,8 @@ function requireNative() {
473
473
  try {
474
474
  const binding = require('@everruns/markkit-linux-ppc64-gnu')
475
475
  const bindingPackageVersion = require('@everruns/markkit-linux-ppc64-gnu/package.json').version
476
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
477
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
476
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
477
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
478
478
  }
479
479
  return binding
480
480
  } catch (e) {
@@ -489,8 +489,8 @@ function requireNative() {
489
489
  try {
490
490
  const binding = require('@everruns/markkit-linux-s390x-gnu')
491
491
  const bindingPackageVersion = require('@everruns/markkit-linux-s390x-gnu/package.json').version
492
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
493
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
492
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
493
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
494
494
  }
495
495
  return binding
496
496
  } catch (e) {
@@ -509,8 +509,8 @@ function requireNative() {
509
509
  try {
510
510
  const binding = require('@everruns/markkit-openharmony-arm64')
511
511
  const bindingPackageVersion = require('@everruns/markkit-openharmony-arm64/package.json').version
512
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
513
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
512
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
513
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
514
514
  }
515
515
  return binding
516
516
  } catch (e) {
@@ -525,8 +525,8 @@ function requireNative() {
525
525
  try {
526
526
  const binding = require('@everruns/markkit-openharmony-x64')
527
527
  const bindingPackageVersion = require('@everruns/markkit-openharmony-x64/package.json').version
528
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
529
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
528
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
529
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
530
530
  }
531
531
  return binding
532
532
  } catch (e) {
@@ -541,8 +541,8 @@ function requireNative() {
541
541
  try {
542
542
  const binding = require('@everruns/markkit-openharmony-arm')
543
543
  const bindingPackageVersion = require('@everruns/markkit-openharmony-arm/package.json').version
544
- if (bindingPackageVersion !== '0.1.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
545
- throw new Error(`Native binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
544
+ if (bindingPackageVersion !== '0.2.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
545
+ throw new Error(`Native binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
546
546
  }
547
547
  return binding
548
548
  } catch (e) {
@@ -683,8 +683,8 @@ if (!nativeBinding || forceWasi) {
683
683
  if (!candidateFailed) {
684
684
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
685
685
  const bindingPackageVersion = require('@everruns/markkit-wasm32-wasi/package.json').version
686
- if (bindingPackageVersion !== '0.1.1') {
687
- throw new Error(`WASI binding package version mismatch, expected 0.1.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
686
+ if (bindingPackageVersion !== '0.2.0') {
687
+ throw new Error(`WASI binding package version mismatch, expected 0.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
688
688
  }
689
689
  }
690
690
  wasiBinding = require('@everruns/markkit-wasm32-wasi')
@@ -836,6 +836,8 @@ function __napiStampBindingTarget(exportsObject, target) {
836
836
  module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
837
837
  module.exports = nativeBinding
838
838
  module.exports.extractBytes = nativeBinding.extractBytes
839
+ module.exports.extractDocument = nativeBinding.extractDocument
840
+ module.exports.extractDocumentSync = nativeBinding.extractDocumentSync
839
841
  module.exports.extractHtml = nativeBinding.extractHtml
840
842
  module.exports.extractHtmlSync = nativeBinding.extractHtmlSync
841
843
  module.exports.extractUrl = nativeBinding.extractUrl
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everruns/markkit",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Extract clean markdown from any format – Node.js bindings",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "license": "MIT",
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/everruns/markkit"
16
+ "url": "git+https://github.com/everruns/markkit.git"
17
17
  },
18
18
  "files": [
19
19
  "index.js",