@everruns/markkit 0.2.0 → 0.3.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.
- package/LICENSE +21 -0
- package/NOTICE +128 -0
- package/README.md +146 -62
- package/index.d.ts +53 -5
- package/index.js +56 -56
- package/markkit.linux-x64-gnu.node +0 -0
- package/package.json +4 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Everruns
|
|
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.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Markkit
|
|
2
|
+
Copyright 2024-2026 Everruns
|
|
3
|
+
|
|
4
|
+
Licensed under the MIT License.
|
|
5
|
+
|
|
6
|
+
=== Design Inspirations ===
|
|
7
|
+
|
|
8
|
+
Markkit is an independent implementation. The following projects
|
|
9
|
+
inspired aspects of its design:
|
|
10
|
+
|
|
11
|
+
* Readability (Apache 2.0) – Mozilla's approach to content extraction
|
|
12
|
+
informed our HTML-to-markdown pipeline design.
|
|
13
|
+
|
|
14
|
+
* Pandoc (GPL-2.0) – The universal document converter's format
|
|
15
|
+
coverage and conversion philosophy inspired our multi-format
|
|
16
|
+
architecture.
|
|
17
|
+
|
|
18
|
+
* turndown (MIT) – The JavaScript HTML-to-markdown converter's
|
|
19
|
+
rule-based approach influenced our conversion engine design.
|
|
20
|
+
|
|
21
|
+
Markkit's parser, converter, and extraction pipeline are original
|
|
22
|
+
Rust implementations. This project is not affiliated with, endorsed
|
|
23
|
+
by, or derived from any of the above projects.
|
|
24
|
+
|
|
25
|
+
=== Key Dependencies ===
|
|
26
|
+
|
|
27
|
+
Markkit relies on permissively licensed crates, including:
|
|
28
|
+
|
|
29
|
+
* scraper (ISC), html5ever (MIT/Apache-2.0) – HTML parsing
|
|
30
|
+
* zip (MIT), quick-xml (MIT), calamine (MIT), cfb (MIT) – Office document containers and XML
|
|
31
|
+
* hayro-syntax / hayro (MIT/Apache-2.0) – PDF parsing and page rendering
|
|
32
|
+
* ocrs, rten (MIT/Apache-2.0) – optional Rust OCR backend
|
|
33
|
+
* reqwest (MIT/Apache-2.0), rustls (Apache-2.0/ISC/MIT) – optional HTTP client
|
|
34
|
+
* tokio (MIT) – async runtime
|
|
35
|
+
* serde / serde_json (MIT/Apache-2.0) – serialization
|
|
36
|
+
* pyo3 (MIT/Apache-2.0), napi (MIT), wasm-bindgen (MIT/Apache-2.0) – bindings
|
|
37
|
+
|
|
38
|
+
The allowed license set is enforced by `cargo deny check licenses` (deny.toml).
|
|
39
|
+
Binary packages (CLI, Python wheels, Node native addon, WebAssembly) statically
|
|
40
|
+
link these crates; their license texts and copyright notices are in each
|
|
41
|
+
crate's source on crates.io, pinned by Cargo.lock. cssparser and selectors
|
|
42
|
+
(via scraper) are MPL-2.0; their unmodified source is available from crates.io.
|
|
43
|
+
|
|
44
|
+
=== Bundled Third-Party Data ===
|
|
45
|
+
|
|
46
|
+
The `pdf-ocr` feature renders PDF pages with hayro, which compiles the
|
|
47
|
+
following data into the binary. It is enabled in the CLI, the Python package
|
|
48
|
+
and the native Node package (not in the default crate build or WebAssembly).
|
|
49
|
+
|
|
50
|
+
--- Standard PDF fonts (hayro-interpret, assets/*.pfb) ---
|
|
51
|
+
|
|
52
|
+
Extracted from PDFium.
|
|
53
|
+
|
|
54
|
+
Copyright 2014 PDFium Authors. All rights reserved.
|
|
55
|
+
Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
56
|
+
|
|
57
|
+
Redistribution and use in source and binary forms, with or without
|
|
58
|
+
modification, are permitted provided that the following conditions are
|
|
59
|
+
met:
|
|
60
|
+
|
|
61
|
+
* Redistributions of source code must retain the above copyright
|
|
62
|
+
notice, this list of conditions and the following disclaimer.
|
|
63
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
64
|
+
notice, this list of conditions and the following disclaimer in the
|
|
65
|
+
documentation and/or other materials provided with the distribution.
|
|
66
|
+
* Neither the name of Google Inc. nor the names of its contributors may be
|
|
67
|
+
used to endorse or promote products derived from this software
|
|
68
|
+
without specific prior written permission.
|
|
69
|
+
|
|
70
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
71
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
72
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
73
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
74
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
75
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
76
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
77
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
78
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
79
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
80
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
81
|
+
|
|
82
|
+
--- Adobe CMap resources (hayro-cmap, assets) ---
|
|
83
|
+
|
|
84
|
+
Copyright 1990-2023 Adobe. All rights reserved.
|
|
85
|
+
|
|
86
|
+
Redistribution and use in source and binary forms, with or without
|
|
87
|
+
modification, are permitted provided that the following conditions are
|
|
88
|
+
met:
|
|
89
|
+
|
|
90
|
+
* Redistributions of source code must retain the above copyright
|
|
91
|
+
notice, this list of conditions and the following disclaimer.
|
|
92
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
93
|
+
notice, this list of conditions and the following disclaimer in the
|
|
94
|
+
documentation and/or other materials provided with the distribution.
|
|
95
|
+
* Neither the name of Adobe nor the names of its contributors may be
|
|
96
|
+
used to endorse or promote products derived from this software
|
|
97
|
+
without specific prior written permission.
|
|
98
|
+
|
|
99
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
100
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
101
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
102
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
103
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
104
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
105
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
106
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
107
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
108
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
109
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
110
|
+
|
|
111
|
+
--- ICC color profiles (hayro-interpret, assets/*.icc) ---
|
|
112
|
+
|
|
113
|
+
CGATS001Compat-v2-micro.icc from saucecontrol/Compact-ICC-Profiles, CC0-1.0.
|
|
114
|
+
LAB.icc generated with LCMS2 by the hayro authors.
|
|
115
|
+
|
|
116
|
+
=== Not Bundled ===
|
|
117
|
+
|
|
118
|
+
OCR model weights (CC-BY-SA 4.0), Tesseract and its language data are not
|
|
119
|
+
included in any markkit package. `just ocr-models` downloads the pinned models
|
|
120
|
+
and writes their license and attribution to target/ocr-models/NOTICE.json.
|
|
121
|
+
|
|
122
|
+
=== Public Benchmark Tooling ===
|
|
123
|
+
|
|
124
|
+
scripts/public_benchmarks/vendor includes the Mira Python SDK (Everruns, MIT),
|
|
125
|
+
the AgentDocBench scorer (SylphxAI, MIT), and the WCXB scorer (Murrough Foley,
|
|
126
|
+
CC-BY-4.0), each with its license. Input documents retain the individual
|
|
127
|
+
licenses and attribution in scripts/public_benchmarks/CORPUS-NOTICE and
|
|
128
|
+
agentdocbench-corpus.json. The downloaded corpora are not included in packages.
|
package/README.md
CHANGED
|
@@ -1,88 +1,172 @@
|
|
|
1
1
|
# @everruns/markkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@everruns/markkit)
|
|
4
|
+
[](https://github.com/everruns/markkit/blob/main/LICENSE)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
native release; Rust and Python package availability is independent.
|
|
6
|
+
**Extract clean Markdown from any document, safely.** Native Node.js bindings
|
|
7
|
+
for [Markkit](https://github.com/everruns/markkit), written in Rust.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Convert HTML, PDF, Word, PowerPoint, Excel/ODS spreadsheets, ODT, EPUB, email
|
|
10
|
+
(EML), Jupyter notebooks, CSV/TSV, Markdown and plain text into well-structured
|
|
11
|
+
Markdown for LLMs, RAG pipelines and agents. Built for untrusted input: nothing
|
|
12
|
+
is executed, and every resource a document can drive is bounded.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
- One call for every format, detected from file name, content type or bytes
|
|
15
|
+
- Title, metadata, stats and structured warnings with every result
|
|
16
|
+
- Main-content detection for web pages, CSS include/exclude selectors
|
|
17
|
+
- PDF reading order, columns, tables, optional layout geometry and OCR
|
|
18
|
+
- URL fetching with SSRF protection
|
|
19
|
+
- TypeScript declarations included; async functions run off the event loop
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @everruns/markkit
|
|
17
25
|
```
|
|
18
26
|
|
|
19
|
-
|
|
27
|
+
The package ships a prebuilt native addon for **Linux x64 (glibc)**. macOS,
|
|
28
|
+
Windows, ARM64 and musl are not published yet; for those, or for browsers and
|
|
29
|
+
edge runtimes, use [`@everruns/markkit-wasm`](https://www.npmjs.com/package/@everruns/markkit-wasm).
|
|
30
|
+
CI verifies a clean install and extraction on Node.js 24.
|
|
20
31
|
|
|
21
|
-
|
|
32
|
+
## Quick start
|
|
22
33
|
|
|
23
34
|
```js
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
await extractHtml(html, { includeSelectors: ['article'], excludeSelectors: ['.ad'], preserveImages: false });
|
|
35
|
+
const fs = require('node:fs');
|
|
36
|
+
const { extractHtmlSync, extractDocument } = require('@everruns/markkit');
|
|
27
37
|
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
console.log(extractHtmlSync('<h1>Hello</h1><p>World</p>'));
|
|
39
|
+
// # Hello
|
|
40
|
+
//
|
|
41
|
+
// World
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log(doc.
|
|
43
|
+
const doc = await extractDocument(fs.readFileSync('report.docx'), { fileName: 'report.docx' });
|
|
44
|
+
console.log(doc.format, doc.title, doc.stats); // docx "Q3 Report" { paragraphs: 7, tables: 1 }
|
|
45
|
+
console.log(doc.markdown);
|
|
34
46
|
```
|
|
35
47
|
|
|
36
|
-
|
|
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).
|
|
48
|
+
ES modules work too: `import { extractHtml } from '@everruns/markkit';`.
|
|
45
49
|
|
|
46
|
-
##
|
|
50
|
+
## API
|
|
47
51
|
|
|
48
|
-
|
|
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
|
+
Every function takes an optional trailing `options` object.
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
| Function | Returns | Use it for |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `extractDocument(data: Buffer, hint?, options?)` | `Promise<Extraction>` | Any format, with metadata |
|
|
57
|
+
| `extractDocumentSync(data, hint?, options?)` | `Extraction` | Same, synchronous |
|
|
58
|
+
| `extractHtml(html: string, options?)` | `Promise<string>` | HTML string to Markdown |
|
|
59
|
+
| `extractHtmlSync(html, options?)` | `string` | Same, synchronous |
|
|
60
|
+
| `extractBytes(data: Buffer, contentType?, options?)` | `Promise<string>` | Bytes to Markdown only |
|
|
61
|
+
| `extractUrl(url: string, options?)` | `Promise<string>` | Fetch and convert a URL |
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
`
|
|
62
|
-
|
|
63
|
-
Markdown, excluding JSON wrapper/pretty-print overhead.
|
|
63
|
+
`hint` is `{ contentType?: string, fileName?: string }`. The format is detected
|
|
64
|
+
from `contentType`, then the extension of `fileName`, then magic bytes. The
|
|
65
|
+
sync variants are CPU-bound and block the event loop while they run.
|
|
64
66
|
|
|
65
|
-
|
|
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.
|
|
67
|
+
`Extraction`:
|
|
69
68
|
|
|
70
|
-
|
|
69
|
+
| Field | Type | Contents |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `markdown` | `string` | The Markdown |
|
|
72
|
+
| `title` | `string \| undefined` | Title when the source declares one |
|
|
73
|
+
| `format` | `string` | `html`, `pdf`, `docx`, `pptx`, `xlsx`, `xlsb`, `xls`, `ods`, `odt`, `epub`, `eml`, `ipynb`, `csv`, `tsv`, `markdown`, `text` |
|
|
74
|
+
| `warnings` | `{ code, detail }[]` | e.g. `{ code: 'truncated_sheet', detail: '...' }`; match on `code` |
|
|
75
|
+
| `stats` | `ExtractionStats` | `pages`, `sheets`, `rows`, `paragraphs`, `tables` |
|
|
76
|
+
| `metadata` | `Metadata` | HTML `description`, `author`, `published`, `language`, `canonicalUrl`, `siteName`, `image` |
|
|
77
|
+
| `layout` | `PdfLayout \| undefined` | PDF geometry, only with `pdfLayout: true` |
|
|
71
78
|
|
|
72
|
-
|
|
73
|
-
builds retain Tesseract. Prepare the pinned models from the repository with
|
|
74
|
-
`python3 scripts/prepare_ocr_models.py`, then configure:
|
|
79
|
+
## Options
|
|
75
80
|
|
|
76
81
|
```js
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
const { extractHtml, extractUrl } = require('@everruns/markkit');
|
|
83
|
+
|
|
84
|
+
await extractHtml(html, {
|
|
85
|
+
mainContent: true, // keep the article, drop sidebars and comments
|
|
86
|
+
includeSelectors: ['main'], // keep only matches
|
|
87
|
+
excludeSelectors: ['.ad'], // drop matches (on top of nav/footer/script/...)
|
|
88
|
+
baseUrl: 'https://example.com/blog/', // resolve relative links and images
|
|
89
|
+
preserveImages: false,
|
|
81
90
|
});
|
|
91
|
+
|
|
92
|
+
// URLs: loopback, private, link-local and metadata addresses are refused,
|
|
93
|
+
// also after DNS resolution and on every redirect.
|
|
94
|
+
await extractUrl('https://docs.example.com/page', { allowedHosts: ['docs.example.com'], maxRedirects: 2 });
|
|
82
95
|
```
|
|
83
96
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
| Option | Default | Meaning |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `mainContent` | `false` | Keep only the detected article body |
|
|
100
|
+
| `includeSelectors` / `excludeSelectors` | `[]` | CSS selectors to keep / drop |
|
|
101
|
+
| `baseUrl` | none | Base for relative links and images |
|
|
102
|
+
| `preserveLinks` / `preserveImages` | `true` | Keep `[text](url)` / `` |
|
|
103
|
+
| `includeHiddenSheets` | `false` | Render hidden spreadsheet sheets |
|
|
104
|
+
| `pdfLayout` | `false` | Add `layout` geometry for PDFs |
|
|
105
|
+
| `pdfRemoveRepeatedHeaders` | `false` | Drop running PDF headers/footers |
|
|
106
|
+
| `pdfOcr`, `pdfOcrLanguage` | `false`, `"eng"` | OCR textless PDF pages with Tesseract |
|
|
107
|
+
| `pdfOcrBackend`, `pdfOcrDetectionModel`, `pdfOcrRecognitionModel` | `"tesseract"` | Rust `ocrs` backend (source builds) |
|
|
108
|
+
| `allowPrivateNetworks` | `false` | Let `extractUrl` reach internal hosts (trusted URLs only) |
|
|
109
|
+
| `allowedHosts` | `[]` | Host allowlist for `extractUrl`, checked on every redirect |
|
|
110
|
+
|
|
111
|
+
### Limits and errors
|
|
112
|
+
|
|
113
|
+
| Option | Default | Bounds |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| `maxInputSize` | 50 MiB | Input bytes, fetched body |
|
|
116
|
+
| `maxOutputSize` | 128 MiB | Markdown output bytes |
|
|
117
|
+
| `timeout` | 60 | Seconds per call, fractions allowed (`maxProcessingSecs` is the whole-second form) |
|
|
118
|
+
| `maxNodes` | 5 000 000 | Parsed nodes, retained PDF geometry |
|
|
119
|
+
| `maxNestingDepth` | 256 | Element nesting (hard max 512) |
|
|
120
|
+
| `maxArchiveEntries` | 10 000 | ZIP entries |
|
|
121
|
+
| `maxArchiveEntrySize` / `maxArchiveTotalSize` | 64 / 256 MiB | Decompressed ZIP bytes |
|
|
122
|
+
| `maxSheetRows` / `maxSheetCols` | 10 000 / 256 | Rendered per sheet (truncated with a warning) |
|
|
123
|
+
| `maxSpreadsheetCells` | 4 000 000 | XLS/ODS grid before parsing |
|
|
124
|
+
| `maxRedirects` | 5 | `extractUrl` redirects |
|
|
125
|
+
| `maxPdfPages` | 10 000 | PDF pages (truncated with a warning) |
|
|
126
|
+
| `maxPdfStreamSize` / `maxPdfDecodedSize` | 64 / 256 MiB | Decoded PDF bytes |
|
|
127
|
+
|
|
128
|
+
Failures throw an `Error` whose message names the cause:
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
try {
|
|
132
|
+
extractDocumentSync(bytes, { fileName: 'big.xlsx' }, { maxOutputSize: 1 << 20, timeout: 10 });
|
|
133
|
+
} catch (err) {
|
|
134
|
+
console.error(err.message); // "Resource limit exceeded: output exceeds max_output_size 1048576"
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## PDF layout and OCR
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
const doc = extractDocumentSync(pdfBytes, { fileName: 'report.pdf' }, { pdfLayout: true });
|
|
142
|
+
for (const block of doc.layout.pages[0].blocks) {
|
|
143
|
+
console.log(block.kind, block.bbox); // reading order; bbox is [left, top, right, bottom]
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
PDF extraction rebuilds reading order and columns, ruled and borderless tables
|
|
148
|
+
(with merged and wrapped cells), emphasis, numbered lists and tagged headings.
|
|
149
|
+
`layout` is `{ version: 1, pages }`. Each page has source `spans` (text runs
|
|
150
|
+
with `bbox`, `baseline`, `font`, `size`, `words`) and semantic `blocks`
|
|
151
|
+
(`kind`, `bbox`, `spanIds`, `lines`, table `cells`). Coordinates are points
|
|
152
|
+
from the page's top-left, x right and y down. Layout never changes the
|
|
153
|
+
Markdown.
|
|
154
|
+
|
|
155
|
+
Scanned pages: install Tesseract and language data, then pass
|
|
156
|
+
`{ pdfOcr: true, pdfOcrLanguage: 'eng', timeout: 300 }`. Only pages without
|
|
157
|
+
text are recognized. Source builds can enable the Rust `ocrs` backend (Cargo
|
|
158
|
+
feature `pdf-ocr-ocrs`) with local ONNX model paths; extraction never
|
|
159
|
+
downloads models. See the
|
|
160
|
+
[PDF guide](https://github.com/everruns/markkit/blob/main/docs/pdf.md).
|
|
161
|
+
|
|
162
|
+
## Examples
|
|
163
|
+
|
|
164
|
+
Runnable scripts in
|
|
165
|
+
[`examples/node/`](https://github.com/everruns/markkit/tree/main/examples/node):
|
|
166
|
+
`quickstart.cjs` (HTML, options, bytes) and `documents.cjs` (DOCX, XLSX, PDF
|
|
167
|
+
with stats, limits and layout; pass your own files as arguments).
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT. See [LICENSE](https://github.com/everruns/markkit/blob/main/LICENSE); third-party notices are in
|
|
172
|
+
[NOTICE](https://github.com/everruns/markkit/blob/main/NOTICE).
|
package/index.d.ts
CHANGED
|
@@ -17,13 +17,21 @@ export interface DocumentHint {
|
|
|
17
17
|
fileName?: string
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Extract Markdown from a buffer; the format is detected from `contentType`
|
|
22
|
+
* and the bytes. Use `extractDocument` for title, warnings and stats.
|
|
23
|
+
*/
|
|
21
24
|
export declare function extractBytes(data: Buffer, contentType?: string | undefined | null, options?: MarkkitOptions | undefined | null): Promise<string>
|
|
22
25
|
|
|
23
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Convert document bytes (HTML, PDF, DOCX, PPTX, XLSX/XLSB/XLS/ODS, ODT, EPUB,
|
|
28
|
+
* EML, CSV/TSV, ipynb, Markdown, text) to Markdown plus title, format,
|
|
29
|
+
* warnings, stats and metadata (async). The format is detected from
|
|
30
|
+
* `hint.contentType`, then `hint.fileName`'s extension, then magic bytes.
|
|
31
|
+
*/
|
|
24
32
|
export declare function extractDocument(data: Buffer, hint?: DocumentHint | undefined | null, options?: MarkkitOptions | undefined | null): Promise<Extraction>
|
|
25
33
|
|
|
26
|
-
/**
|
|
34
|
+
/** Synchronous `extractDocument`. CPU-bound: blocks the event loop while it runs. */
|
|
27
35
|
export declare function extractDocumentSync(data: Buffer, hint?: DocumentHint | undefined | null, options?: MarkkitOptions | undefined | null): Extraction
|
|
28
36
|
|
|
29
37
|
/** Extract markdown from an HTML string (async). */
|
|
@@ -32,23 +40,35 @@ export declare function extractHtml(html: string, options?: MarkkitOptions | und
|
|
|
32
40
|
/** Extract markdown from an HTML string (synchronous). */
|
|
33
41
|
export declare function extractHtmlSync(html: string, options?: MarkkitOptions | undefined | null): string
|
|
34
42
|
|
|
35
|
-
/** Markdown plus metadata
|
|
43
|
+
/** Markdown plus metadata, returned by `extractDocument` / `extractDocumentSync`. */
|
|
36
44
|
export interface Extraction {
|
|
45
|
+
/** PDF source geometry; present only with `pdfLayout: true` on PDF input. */
|
|
37
46
|
layout?: PdfLayout
|
|
47
|
+
/** The extracted Markdown. */
|
|
38
48
|
markdown: string
|
|
49
|
+
/** Document title when the source declares one (HTML `<title>`, document properties). */
|
|
39
50
|
title?: string
|
|
40
|
-
/** Detected format (`html`, `docx`, `pptx`, `xlsx`, `xlsb`, `xls`, `ods`, `text`, `markdown`, `csv`, `tsv`, `ipynb`, `eml`, `odt`, `epub`). */
|
|
51
|
+
/** Detected format (`html`, `pdf`, `docx`, `pptx`, `xlsx`, `xlsb`, `xls`, `ods`, `text`, `markdown`, `csv`, `tsv`, `ipynb`, `eml`, `odt`, `epub`). */
|
|
41
52
|
format: string
|
|
53
|
+
/** Non-fatal issues: truncation, skipped hidden content, encoding problems. */
|
|
42
54
|
warnings: Array<Warning>
|
|
55
|
+
/** Page, sheet, row, paragraph and table counts. */
|
|
43
56
|
stats: ExtractionStats
|
|
57
|
+
/** HTML page metadata; empty for other formats. */
|
|
44
58
|
metadata: Metadata
|
|
45
59
|
}
|
|
46
60
|
|
|
61
|
+
/** Document counts; a field is absent when it does not apply to the format. */
|
|
47
62
|
export interface ExtractionStats {
|
|
63
|
+
/** PDF pages. */
|
|
48
64
|
pages?: number
|
|
65
|
+
/** Rendered spreadsheet sheets. */
|
|
49
66
|
sheets?: number
|
|
67
|
+
/** Rendered spreadsheet / CSV data rows. */
|
|
50
68
|
rows?: number
|
|
69
|
+
/** Paragraph blocks. */
|
|
51
70
|
paragraphs?: number
|
|
71
|
+
/** Tables. */
|
|
52
72
|
tables?: number
|
|
53
73
|
}
|
|
54
74
|
|
|
@@ -84,24 +104,42 @@ export interface MarkkitOptions {
|
|
|
84
104
|
mainContent?: boolean
|
|
85
105
|
/** Retain PDF page dimensions and positioned text runs in `Extraction.layout`. */
|
|
86
106
|
pdfLayout?: boolean
|
|
107
|
+
/** Drop margin headers/footers repeated across PDF pages (default false). */
|
|
87
108
|
pdfRemoveRepeatedHeaders?: boolean
|
|
109
|
+
/**
|
|
110
|
+
* OCR PDF pages that have no text layer (default false). Needs Tesseract
|
|
111
|
+
* and language data installed, or the `ocrs` backend.
|
|
112
|
+
*/
|
|
88
113
|
pdfOcr?: boolean
|
|
114
|
+
/** Tesseract language codes, e.g. `"eng"` or `"eng+deu"` (default `"eng"`). */
|
|
89
115
|
pdfOcrLanguage?: string
|
|
116
|
+
/** `"tesseract"` (default) or `"ocrs"` (source builds with `pdf-ocr-ocrs`). */
|
|
90
117
|
pdfOcrBackend?: string
|
|
118
|
+
/** Local ONNX text-detection model path for the `ocrs` backend. */
|
|
91
119
|
pdfOcrDetectionModel?: string
|
|
120
|
+
/** Local ONNX text-recognition model path for the `ocrs` backend. */
|
|
92
121
|
pdfOcrRecognitionModel?: string
|
|
122
|
+
/** Keep link URLs as `[text](url)` (default true); false keeps the text only. */
|
|
93
123
|
preserveLinks?: boolean
|
|
124
|
+
/** Keep images as `` (default true); false drops them. */
|
|
94
125
|
preserveImages?: boolean
|
|
95
126
|
/** CSS selectors to include (empty = whole document). */
|
|
96
127
|
includeSelectors?: Array<string>
|
|
97
128
|
/** CSS selectors to drop, added to nav/footer/header/script/style/noscript. */
|
|
98
129
|
excludeSelectors?: Array<string>
|
|
130
|
+
/** Maximum ZIP entries in DOCX/PPTX/XLSX/ODT/EPUB containers (default 10 000). */
|
|
99
131
|
maxArchiveEntries?: number
|
|
132
|
+
/** Maximum decompressed bytes per ZIP entry (default 64 MiB). */
|
|
100
133
|
maxArchiveEntrySize?: number
|
|
134
|
+
/** Maximum decompressed bytes per ZIP container (default 256 MiB). */
|
|
101
135
|
maxArchiveTotalSize?: number
|
|
136
|
+
/** Rows rendered per sheet; extra rows are truncated with a warning (default 10 000). */
|
|
102
137
|
maxSheetRows?: number
|
|
138
|
+
/** Columns rendered per sheet; extra columns are truncated with a warning (default 256). */
|
|
103
139
|
maxSheetCols?: number
|
|
140
|
+
/** Maximum XLS/ODS grid cells before parsing (default 4 000 000). */
|
|
104
141
|
maxSpreadsheetCells?: number
|
|
142
|
+
/** Render hidden and very hidden sheets (default false: skipped with a warning). */
|
|
105
143
|
includeHiddenSheets?: boolean
|
|
106
144
|
/** Let `extractUrl` reach loopback/private/link-local addresses. Trusted URLs only. */
|
|
107
145
|
allowPrivateNetworks?: boolean
|
|
@@ -109,19 +147,29 @@ export interface MarkkitOptions {
|
|
|
109
147
|
allowedHosts?: Array<string>
|
|
110
148
|
/** Maximum redirects `extractUrl` follows (default 5). */
|
|
111
149
|
maxRedirects?: number
|
|
150
|
+
/** PDF pages rendered; later pages are truncated with a warning (default 10 000). */
|
|
112
151
|
maxPdfPages?: number
|
|
152
|
+
/** Decoded bytes per PDF stream (default 64 MiB). */
|
|
113
153
|
maxPdfStreamSize?: number
|
|
154
|
+
/** Decoded PDF bytes in total, also bounds retained layout geometry (default 256 MiB). */
|
|
114
155
|
maxPdfDecodedSize?: number
|
|
115
156
|
}
|
|
116
157
|
|
|
117
158
|
/** Document metadata (HTML meta, Open Graph, JSON-LD); fields absent when unknown. */
|
|
118
159
|
export interface Metadata {
|
|
160
|
+
/** Page summary (`<meta name="description">`, `og:description`, JSON-LD). */
|
|
119
161
|
description?: string
|
|
162
|
+
/** Author name. */
|
|
120
163
|
author?: string
|
|
164
|
+
/** Publication date as written in the source (usually ISO 8601). */
|
|
121
165
|
published?: string
|
|
166
|
+
/** Document language, e.g. `en` (from `<html lang>`). */
|
|
122
167
|
language?: string
|
|
168
|
+
/** Canonical URL (`<link rel="canonical">`, `og:url`). */
|
|
123
169
|
canonicalUrl?: string
|
|
170
|
+
/** Site name (`og:site_name`). */
|
|
124
171
|
siteName?: string
|
|
172
|
+
/** Lead image URL (`og:image`). */
|
|
125
173
|
image?: string
|
|
126
174
|
}
|
|
127
175
|
|
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.2
|
|
98
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
97
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
114
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
113
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
135
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
134
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
150
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
168
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
167
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
184
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
183
|
+
if (bindingPackageVersion !== '0.3.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 0.3.2 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.2
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
202
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
219
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
218
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
235
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
234
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
255
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
254
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
271
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
270
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
287
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
286
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
308
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
307
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
324
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
323
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
342
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
341
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
358
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
357
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
376
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
375
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
392
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
391
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
410
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
409
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
426
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
425
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
443
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
459
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
477
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
476
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
493
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
492
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
513
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
512
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
529
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
528
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
545
|
-
throw new Error(`Native binding package version mismatch, expected 0.2
|
|
544
|
+
if (bindingPackageVersion !== '0.3.2' && 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.3.2 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.2
|
|
687
|
-
throw new Error(`WASI binding package version mismatch, expected 0.2
|
|
686
|
+
if (bindingPackageVersion !== '0.3.2') {
|
|
687
|
+
throw new Error(`WASI binding package version mismatch, expected 0.3.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
wasiBinding = require('@everruns/markkit-wasm32-wasi')
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everruns/markkit",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Extract clean markdown from any format – Node.js bindings",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"index.js",
|
|
20
20
|
"index.d.ts",
|
|
21
|
-
"*.node"
|
|
21
|
+
"*.node",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"NOTICE"
|
|
22
24
|
],
|
|
23
25
|
"devDependencies": {
|
|
24
26
|
"@napi-rs/cli": "^3"
|