word-to-markdown 0.2.0 → 0.3.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 +107 -18
- package/build/cli.js +26 -2
- package/build/cli.js.map +1 -1
- package/build/main.js +259 -145
- package/build/main.js.map +1 -1
- package/package.json +10 -12
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Word to Markdown
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/word-to-markdown)
|
|
4
|
+
[](https://www.npmjs.com/package/word-to-markdown)
|
|
5
|
+
[](https://github.com/benbalter/word-to-markdown-js/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/benbalter/word-to-markdown-js/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
Convert Word documents to beautiful Markdown. Via command line, as a Node library, or in your browser. An even better version of the original [`word-to-markdown`](https://github.com/benbalter/word-to-markdown).
|
|
4
9
|
|
|
5
10
|
Try it in your browser at [word2md.com](https://word2md.com), or use it from the command line — no clone required:
|
|
6
11
|
|
|
@@ -8,22 +13,38 @@ Try it in your browser at [word2md.com](https://word2md.com), or use it from the
|
|
|
8
13
|
npx word-to-markdown input.docx > output.md
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## What it converts
|
|
12
17
|
|
|
13
|
-
- Paragraphs
|
|
14
|
-
- Numbered lists
|
|
15
|
-
- Bullet lists
|
|
16
|
-
- Nested Lists
|
|
18
|
+
- Paragraphs and line breaks
|
|
17
19
|
- Headings
|
|
18
|
-
-
|
|
20
|
+
- Bold, italic, and strikethrough
|
|
21
|
+
- Superscript and subscript — preserved as inline `<sup>`/`<sub>` tags
|
|
22
|
+
- Bullet lists, and numbered lists (kept as `1./2./3.` by default)
|
|
23
|
+
- Nested lists
|
|
19
24
|
- Tables
|
|
20
|
-
- Footnotes and endnotes
|
|
21
|
-
- Images
|
|
22
|
-
- Bold, italics, underlines, strikethrough, superscript and subscript.
|
|
23
25
|
- Links
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
|
|
26
|
+
- Footnotes and endnotes
|
|
27
|
+
- Images — embedded inline as base64 data URIs, or extracted to files
|
|
28
|
+
|
|
29
|
+
### Notes and limitations
|
|
30
|
+
|
|
31
|
+
- **Numbered lists** are kept as `1./2./3.` ordered lists. Pass
|
|
32
|
+
`{ numberedLists: 'bullets' }` (library) or `--bullet-lists` (CLI) to convert
|
|
33
|
+
them to bullet lists instead (matching the original word-to-markdown).
|
|
34
|
+
- **Images** are inlined as base64 data URIs by default. To extract them to
|
|
35
|
+
files with relative links instead, use `{ images: 'extract' }` (library — the
|
|
36
|
+
bytes come back on `ConvertResult.images`) or `--image-dir <dir>` (CLI). Drop
|
|
37
|
+
them entirely with `{ images: 'strip' }` / `--strip-images`. On the web,
|
|
38
|
+
documents with images offer a **Download .zip** (Markdown + an `images/`
|
|
39
|
+
folder). For full control, pass a custom [Mammoth image handler](https://github.com/mwilliamson/mammoth.js/#images)
|
|
40
|
+
via `options.mammoth`.
|
|
41
|
+
- **Underline** is dropped by default (Mammoth's default, since underlines are
|
|
42
|
+
easily confused with links). Pass `{ underline: 'preserve' }` (library) or
|
|
43
|
+
`--underline` (CLI) to keep it as an inline `<u>` tag.
|
|
44
|
+
- **Comments, text boxes, and equations are not converted** — Mammoth drops
|
|
45
|
+
them during the `.docx` → HTML step. When content is dropped this way,
|
|
46
|
+
`convertWithWarnings` surfaces a warning.
|
|
47
|
+
- Heading levels come from Word's paragraph styles, not from font size.
|
|
27
48
|
|
|
28
49
|
## How is this different from the original?
|
|
29
50
|
|
|
@@ -56,8 +77,21 @@ npm install -g word-to-markdown
|
|
|
56
77
|
w2m path/to/your/file.docx > output.md
|
|
57
78
|
```
|
|
58
79
|
|
|
80
|
+
The converted Markdown is written to **stdout** and any document warnings (encryption, sensitivity labels, and the like) to **stderr**, so a redirect captures only the Markdown. The command exits with a non-zero status and a friendly message if the file is missing, unreadable, or not a valid `.docx`. Only `.docx` is supported — re-save older `.doc` files as `.docx` first.
|
|
81
|
+
|
|
82
|
+
Options:
|
|
83
|
+
|
|
84
|
+
- `--bullet-lists` — convert numbered lists to bullets instead of keeping `1./2./3.`.
|
|
85
|
+
- `--underline` — preserve underlined text as inline `<u>` tags (dropped by default).
|
|
86
|
+
- `--strip-images` — remove images instead of embedding them as base64 data URIs.
|
|
87
|
+
- `--image-dir <dir>` — extract images to `<dir>` and link them relatively, instead
|
|
88
|
+
of embedding base64. Links resolve relative to where you save the Markdown, e.g.
|
|
89
|
+
`w2m --image-dir images report.docx > report.md`.
|
|
90
|
+
|
|
59
91
|
## Use as a library
|
|
60
92
|
|
|
93
|
+
Published to npm as [`word-to-markdown`](https://www.npmjs.com/package/word-to-markdown). It ships as an ES module and requires Node 22.13 or later.
|
|
94
|
+
|
|
61
95
|
```console
|
|
62
96
|
npm install word-to-markdown
|
|
63
97
|
```
|
|
@@ -74,7 +108,62 @@ const { markdown, warnings } = await convertWithWarnings(
|
|
|
74
108
|
);
|
|
75
109
|
```
|
|
76
110
|
|
|
77
|
-
|
|
111
|
+
Both functions accept either a file-path string (in Node) or an `ArrayBuffer` (in the browser), so the same code runs in either environment:
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
const { markdown } = await convertWithWarnings(arrayBuffer);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### API
|
|
118
|
+
|
|
119
|
+
- **`convert(input, options?): Promise<string>`** — resolves to the Markdown.
|
|
120
|
+
- **`convertWithWarnings(input, options?): Promise<{ markdown: string; warnings: string[]; images? }>`** — also returns human-readable warnings for encrypted, protected, or sensitivity-labeled documents, and (in `extract` mode) the extracted images.
|
|
121
|
+
|
|
122
|
+
`input` is a file-path `string` (Node) or an `ArrayBuffer` (browser). `options` is optional:
|
|
123
|
+
|
|
124
|
+
- **`images`** — `'inline'` (default) embeds images as base64 data URIs; `'strip'` removes them; `'extract'` replaces each with a relative `` link and returns the bytes on `ConvertResult.images` (use `convertWithWarnings` to retrieve them).
|
|
125
|
+
- **`imageDir`** — link/path prefix for extracted images (default `'images'`); only applies with `images: 'extract'`.
|
|
126
|
+
- **`numberedLists`** — `'ordered'` (default) keeps `1./2./3.`; `'bullets'` converts numbered lists to bullets.
|
|
127
|
+
- **`underline`** — `'ignore'` (default) drops underlines; `'preserve'` keeps them as inline `<u>` tags.
|
|
128
|
+
- **`mammoth`** / **`turndown`** — escape hatches forwarded to [Mammoth](https://github.com/mwilliamson/mammoth.js/) and [Turndown](https://github.com/mixmark-io/turndown) respectively.
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
// Extract images to files and write them out yourself:
|
|
132
|
+
const { markdown, images } = await convertWithWarnings('file.docx', {
|
|
133
|
+
images: 'extract',
|
|
134
|
+
});
|
|
135
|
+
// markdown → ; images → [{ path, contentType, bytes }]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Error handling
|
|
139
|
+
|
|
140
|
+
Conversion throws typed errors so you can respond to each failure precisely:
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
import convert, {
|
|
144
|
+
UnsupportedFileError,
|
|
145
|
+
FileNotFoundError,
|
|
146
|
+
InvalidFileError,
|
|
147
|
+
FilePermissionError,
|
|
148
|
+
ConversionError,
|
|
149
|
+
} from 'word-to-markdown';
|
|
150
|
+
|
|
151
|
+
try {
|
|
152
|
+
const markdown = await convert('path/to/your/file.docx');
|
|
153
|
+
} catch (error) {
|
|
154
|
+
if (error instanceof UnsupportedFileError) {
|
|
155
|
+
// e.g. a .doc file — only .docx is supported
|
|
156
|
+
} else if (error instanceof FileNotFoundError) {
|
|
157
|
+
// the path doesn't exist
|
|
158
|
+
} else if (error instanceof InvalidFileError) {
|
|
159
|
+
// not a valid or parseable .docx
|
|
160
|
+
} else if (error instanceof FilePermissionError) {
|
|
161
|
+
// the file couldn't be read
|
|
162
|
+
} else if (error instanceof ConversionError) {
|
|
163
|
+
// something failed mid-conversion — see error.cause
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
78
167
|
|
|
79
168
|
## Running Locally
|
|
80
169
|
|
|
@@ -98,7 +187,7 @@ To self-host the static site using Docker Compose:
|
|
|
98
187
|
|
|
99
188
|
1. Clone the repository
|
|
100
189
|
2. Run `npm install && npm run build`
|
|
101
|
-
3. Run `docker
|
|
190
|
+
3. Run `docker compose up -d`
|
|
102
191
|
4. Access at http://localhost:3000
|
|
103
192
|
|
|
104
193
|
## More context
|
|
@@ -111,12 +200,12 @@ See the README of [the original Word to Markdown](https://github.com/benbalter/w
|
|
|
111
200
|
|
|
112
201
|
1. Use [LibreOffice](https://www.libreoffice.org/) to convert the Word document to HTML.
|
|
113
202
|
2. Use a bunch of RegEx to clean up the HTML
|
|
114
|
-
3.
|
|
203
|
+
3. Use [Premailer](https://github.com/premailer/premailer) to inline the CSS
|
|
115
204
|
4. Use [Nokogiri](https://nokogiri.org) to manipulate the HTML further
|
|
116
205
|
5. Use [Reverse Markdown](https://github.com/xijo/reverse_markdown) to convert the HTML to Markdown
|
|
117
206
|
6. Use a bunch of RegEx to clean up the Markdown
|
|
118
207
|
|
|
119
|
-
Not only did this process require installing and shelling out to a huge binary (LibreOffice), but it was very fragile, and key projects like Reverse Markdown are no longer maintained. I tried experimenting with Pandoc, but it had many of the same
|
|
208
|
+
Not only did this process require installing and shelling out to a huge binary (LibreOffice), but it was very fragile, and key projects like Reverse Markdown are no longer maintained. I tried experimenting with Pandoc, but it had many of the same limitations.
|
|
120
209
|
|
|
121
210
|
### The new way
|
|
122
211
|
|
|
@@ -126,6 +215,6 @@ Not only did this process require installing and shelling out to a huge binary (
|
|
|
126
215
|
|
|
127
216
|
All three of these projects are actively maintained and heavily used, and allows us to convert the document faster, and entirely in JavaScript. Heck, I think theoretically, this could run in the browser for added privacy.
|
|
128
217
|
|
|
129
|
-
It's still
|
|
218
|
+
It's still young, but so far, I've found the output to be better, with much less manual cleanup required. Notice something is off? Please [open an issue](https://github.com/benbalter/word-to-markdown-js/issues/new).
|
|
130
219
|
|
|
131
220
|
One note: This project does not yet attempt to guess heading levels based on font size. It could, but it's not yet implemented.
|
package/build/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { __awaiter } from "tslib";
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
+
import { mkdir, writeFile } from 'fs/promises';
|
|
4
5
|
import { convertWithWarnings, UnsupportedFileError, FileNotFoundError, InvalidFileError, FilePermissionError, ConversionError, } from './main.js';
|
|
5
6
|
const program = new Command();
|
|
6
7
|
program.name('w2m');
|
|
@@ -8,9 +9,32 @@ program.description('Convert Word documents to beautiful Markdown');
|
|
|
8
9
|
program
|
|
9
10
|
.command('convert', { isDefault: true })
|
|
10
11
|
.argument('<file>', 'The Word document to convert')
|
|
11
|
-
.
|
|
12
|
+
.option('--strip-images', 'Remove images instead of embedding them as base64 data URIs')
|
|
13
|
+
.option('--image-dir <dir>', 'Extract images to <dir> and link them relatively, instead of embedding ' +
|
|
14
|
+
'them as base64. Links resolve relative to where you save the Markdown.')
|
|
15
|
+
.option('--bullet-lists', 'Convert numbered lists to bullets rather than keeping them as 1./2./3.')
|
|
16
|
+
.option('--underline', 'Preserve underlined text as inline <u> tags (dropped by default)')
|
|
17
|
+
.action((file, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
18
|
try {
|
|
13
|
-
|
|
19
|
+
// --image-dir (extract) takes precedence over --strip-images.
|
|
20
|
+
const images = options.imageDir
|
|
21
|
+
? 'extract'
|
|
22
|
+
: options.stripImages
|
|
23
|
+
? 'strip'
|
|
24
|
+
: 'inline';
|
|
25
|
+
const result = yield convertWithWarnings(file, {
|
|
26
|
+
images,
|
|
27
|
+
imageDir: options.imageDir,
|
|
28
|
+
numberedLists: options.bulletLists ? 'bullets' : 'ordered',
|
|
29
|
+
underline: options.underline ? 'preserve' : 'ignore',
|
|
30
|
+
});
|
|
31
|
+
// Write extracted images to disk before emitting the Markdown that links
|
|
32
|
+
// them. Paths are already prefixed with the requested directory.
|
|
33
|
+
if (result.images && result.images.length > 0) {
|
|
34
|
+
yield mkdir(options.imageDir, { recursive: true });
|
|
35
|
+
yield Promise.all(result.images.map((image) => writeFile(image.path, image.bytes)));
|
|
36
|
+
console.error(`Wrote ${result.images.length} image(s) to ${options.imageDir}/`);
|
|
37
|
+
}
|
|
14
38
|
// Display warnings to stderr if any
|
|
15
39
|
if (result.warnings.length > 0) {
|
|
16
40
|
result.warnings.forEach((warning) => {
|
package/build/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpB,OAAO,CAAC,WAAW,CAAC,8CAA8C,CAAC,CAAC;AACpE,OAAO;KACJ,OAAO,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KACvC,QAAQ,CAAC,QAAQ,EAAE,8BAA8B,CAAC;KAClD,MAAM,CAAC,CAAO,IAAI,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,M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CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/build/main.js
CHANGED
|
@@ -74,15 +74,14 @@ export function validateFileExtension(filePath) {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
// Validates that a file path is safe to use and returns the resolved path (Node.js only)
|
|
77
|
-
// Prevents path traversal attacks by checking for parent directory references
|
|
78
77
|
function validateFilePath(filePath) {
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
// Note:
|
|
85
|
-
//
|
|
78
|
+
// Resolve to an absolute path first. path.resolve normalizes any `..`
|
|
79
|
+
// segments, so we deliberately do NOT reject paths that merely contain `..`:
|
|
80
|
+
// a relative path like `../report.docx`, or a filename like `notes..docx`, is
|
|
81
|
+
// legitimate CLI/library usage. (There is no sandbox to escape here — a local
|
|
82
|
+
// caller already has full filesystem access.)
|
|
83
|
+
// Note: the path module is Node.js-only, but this function is only called in
|
|
84
|
+
// Node.js contexts (CLI, direct API use with file paths).
|
|
86
85
|
const resolvedPath = path.resolve(filePath);
|
|
87
86
|
// Check for absolute paths to dangerous system directories (Unix-like systems)
|
|
88
87
|
const dangerousPaths = ['/etc/', '/sys/', '/proc/', '/root/', '/boot/'];
|
|
@@ -123,6 +122,17 @@ const decodeMap = {
|
|
|
123
122
|
};
|
|
124
123
|
// Maximum iterations for decoding nested HTML entities to prevent infinite loops
|
|
125
124
|
const MAX_DECODE_ITERATIONS = 10;
|
|
125
|
+
// Convert a numeric code point to a string, returning the original entity text
|
|
126
|
+
// for out-of-range values (fromCodePoint throws a RangeError on those, unlike
|
|
127
|
+
// the legacy fromCharCode which silently wrapped).
|
|
128
|
+
function codePointToString(codePoint, original) {
|
|
129
|
+
try {
|
|
130
|
+
return String.fromCodePoint(codePoint);
|
|
131
|
+
}
|
|
132
|
+
catch (_a) {
|
|
133
|
+
return original;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
126
136
|
// Decode HTML entities in text content
|
|
127
137
|
function decodeHtmlEntities(html) {
|
|
128
138
|
function decodeOnce(text) {
|
|
@@ -137,15 +147,16 @@ function decodeHtmlEntities(html) {
|
|
|
137
147
|
if (decodeMap[entity]) {
|
|
138
148
|
return decodeMap[entity];
|
|
139
149
|
}
|
|
140
|
-
// Handle numeric entities {
|
|
150
|
+
// Handle numeric entities { (fromCodePoint handles astral-plane
|
|
151
|
+
// code points > U+FFFF, e.g. emoji, which fromCharCode would truncate)
|
|
141
152
|
const numericMatch = entity.match(/^&#(\d+);$/);
|
|
142
153
|
if (numericMatch) {
|
|
143
|
-
return
|
|
154
|
+
return codePointToString(parseInt(numericMatch[1], 10), entity);
|
|
144
155
|
}
|
|
145
156
|
// Handle hex entities 
|
|
146
157
|
const hexMatch = entity.match(/^&#x([0-9a-fA-F]+);$/i);
|
|
147
158
|
if (hexMatch) {
|
|
148
|
-
return
|
|
159
|
+
return codePointToString(parseInt(hexMatch[1], 16), entity);
|
|
149
160
|
}
|
|
150
161
|
// Return original if not recognized
|
|
151
162
|
return entity;
|
|
@@ -171,10 +182,16 @@ function decodeHtmlEntities(html) {
|
|
|
171
182
|
// Common unicode bullets that might appear in Word documents - compiled once
|
|
172
183
|
const unicodeBullets = ['•', '◦', '▪', '▫', '‣', '⁃', '∙', '·'];
|
|
173
184
|
const bulletRegex = new RegExp(`^\\s*[${unicodeBullets.map((b) => b.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('')}]\\s*`);
|
|
174
|
-
// Process HTML in a single pass:
|
|
175
|
-
// This is more efficient than parsing the
|
|
176
|
-
|
|
185
|
+
// Process HTML in a single pass: optionally strip images, convert table
|
|
186
|
+
// headers, and remove unicode bullets. This is more efficient than parsing the
|
|
187
|
+
// HTML twice.
|
|
188
|
+
function processHtml(html, opts = {}) {
|
|
177
189
|
const root = parse(html);
|
|
190
|
+
// Remove images (Mammoth inlines them as base64 data URIs by default, which
|
|
191
|
+
// can bloat the output for image-heavy documents).
|
|
192
|
+
if (opts.stripImages) {
|
|
193
|
+
root.querySelectorAll('img').forEach((img) => img.remove());
|
|
194
|
+
}
|
|
178
195
|
// Process tables - convert first row to table headers
|
|
179
196
|
root.querySelectorAll('table').forEach((table) => {
|
|
180
197
|
const firstRow = table.querySelector('tr');
|
|
@@ -216,11 +233,16 @@ function processHtml(html) {
|
|
|
216
233
|
}
|
|
217
234
|
// Reusable TurndownService instance to avoid recreating it for each conversion
|
|
218
235
|
let turndownServiceInstance = null;
|
|
219
|
-
function getTurndownService(options = {}) {
|
|
220
|
-
// Create a new instance if options are provided
|
|
221
|
-
|
|
222
|
-
|
|
236
|
+
function getTurndownService(options = {}, keepTags = []) {
|
|
237
|
+
// Create a new instance if options or keep-tags are provided; otherwise reuse
|
|
238
|
+
// the singleton. `keep()` mutates the instance, so it must never touch the
|
|
239
|
+
// shared singleton — a fresh service is required whenever keepTags is set.
|
|
240
|
+
if (Object.keys(options).length > 0 || keepTags.length > 0) {
|
|
241
|
+
const service = new TurndownService(Object.assign(Object.assign({}, defaultTurndownOptions), options));
|
|
223
242
|
service.use(turndownPluginGfm.gfm);
|
|
243
|
+
if (keepTags.length > 0) {
|
|
244
|
+
service.keep(keepTags);
|
|
245
|
+
}
|
|
224
246
|
return service;
|
|
225
247
|
}
|
|
226
248
|
if (!turndownServiceInstance) {
|
|
@@ -229,11 +251,13 @@ function getTurndownService(options = {}) {
|
|
|
229
251
|
}
|
|
230
252
|
return turndownServiceInstance;
|
|
231
253
|
}
|
|
232
|
-
// Convert HTML to GitHub-flavored Markdown
|
|
233
|
-
|
|
254
|
+
// Convert HTML to GitHub-flavored Markdown. `keepTags` lists HTML tags to
|
|
255
|
+
// preserve verbatim as inline HTML (e.g. `['u']` to keep underlines) rather
|
|
256
|
+
// than let Turndown strip them to plain text.
|
|
257
|
+
export function htmlToMd(html, options = {}, keepTags = []) {
|
|
234
258
|
// Decode HTML entities before conversion
|
|
235
259
|
const decodedHtml = decodeHtmlEntities(html);
|
|
236
|
-
const turndownService = getTurndownService(options);
|
|
260
|
+
const turndownService = getTurndownService(options, keepTags);
|
|
237
261
|
return turndownService.turndown(decodedHtml).trim();
|
|
238
262
|
}
|
|
239
263
|
// Pre-compiled regex patterns for better performance
|
|
@@ -295,20 +319,7 @@ export function extractDocumentProperties(input) {
|
|
|
295
319
|
const safePath = validateFilePath(input);
|
|
296
320
|
// Read file from path and convert to ArrayBuffer
|
|
297
321
|
const fileBuffer = yield fs.readFile(safePath);
|
|
298
|
-
|
|
299
|
-
// Ensure we have an ArrayBuffer (not SharedArrayBuffer)
|
|
300
|
-
// In practice, Node.js Buffer.buffer returns an ArrayBuffer, but TypeScript
|
|
301
|
-
// can't guarantee this, so we handle both cases
|
|
302
|
-
if (slicedBuffer instanceof ArrayBuffer) {
|
|
303
|
-
arrayBuffer = slicedBuffer;
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
// Convert SharedArrayBuffer to ArrayBuffer by copying the data
|
|
307
|
-
const uint8Array = new Uint8Array(slicedBuffer);
|
|
308
|
-
const newArrayBuffer = new ArrayBuffer(uint8Array.byteLength);
|
|
309
|
-
new Uint8Array(newArrayBuffer).set(uint8Array);
|
|
310
|
-
arrayBuffer = newArrayBuffer;
|
|
311
|
-
}
|
|
322
|
+
arrayBuffer = toArrayBuffer(fileBuffer.buffer.slice(fileBuffer.byteOffset, fileBuffer.byteOffset + fileBuffer.byteLength));
|
|
312
323
|
}
|
|
313
324
|
else {
|
|
314
325
|
arrayBuffer = input;
|
|
@@ -392,6 +403,203 @@ export function generateWarnings(properties) {
|
|
|
392
403
|
}
|
|
393
404
|
return warnings;
|
|
394
405
|
}
|
|
406
|
+
// Ensure we have an ArrayBuffer (not a SharedArrayBuffer) by copying if needed
|
|
407
|
+
function toArrayBuffer(buffer) {
|
|
408
|
+
if (buffer instanceof ArrayBuffer) {
|
|
409
|
+
return buffer;
|
|
410
|
+
}
|
|
411
|
+
const uint8Array = new Uint8Array(buffer);
|
|
412
|
+
const newArrayBuffer = new ArrayBuffer(uint8Array.byteLength);
|
|
413
|
+
new Uint8Array(newArrayBuffer).set(uint8Array);
|
|
414
|
+
return newArrayBuffer;
|
|
415
|
+
}
|
|
416
|
+
// Append the underline style-mapping to any caller-supplied Mammoth options.
|
|
417
|
+
// Mammoth ignores underlines unless the style map maps them; `u => u` emits a
|
|
418
|
+
// `<u>` element. The entry is appended (not replaced) so Mammoth's default
|
|
419
|
+
// mappings — including superscript/subscript — are preserved.
|
|
420
|
+
function withUnderlineStyleMap(mammothOptions) {
|
|
421
|
+
var _a;
|
|
422
|
+
const existing = (_a = mammothOptions === null || mammothOptions === void 0 ? void 0 : mammothOptions.styleMap) !== null && _a !== void 0 ? _a : [];
|
|
423
|
+
return Object.assign(Object.assign({}, mammothOptions), { styleMap: [...existing, 'u => u'] });
|
|
424
|
+
}
|
|
425
|
+
// Common image content types → file extension. Word most often embeds PNG and
|
|
426
|
+
// JPEG; the rest cover formats Mammoth may surface. EMF/WMF are extracted as
|
|
427
|
+
// bytes for completeness but browsers can't render them (Mammoth won't transcode).
|
|
428
|
+
const CONTENT_TYPE_EXTENSIONS = {
|
|
429
|
+
'image/png': 'png',
|
|
430
|
+
'image/jpeg': 'jpg',
|
|
431
|
+
'image/jpg': 'jpg',
|
|
432
|
+
'image/gif': 'gif',
|
|
433
|
+
'image/tiff': 'tiff',
|
|
434
|
+
'image/bmp': 'bmp',
|
|
435
|
+
'image/webp': 'webp',
|
|
436
|
+
'image/svg+xml': 'svg',
|
|
437
|
+
'image/x-emf': 'emf',
|
|
438
|
+
'image/x-wmf': 'wmf',
|
|
439
|
+
};
|
|
440
|
+
// Pick a file extension for an extracted image. Falls back to the content
|
|
441
|
+
// type's subtype when it's a clean alphanumeric token, else `bin`. Exported for
|
|
442
|
+
// unit testing since only a PNG fixture exists.
|
|
443
|
+
export function extensionForContentType(contentType) {
|
|
444
|
+
var _a;
|
|
445
|
+
const normalized = contentType.toLowerCase();
|
|
446
|
+
const known = CONTENT_TYPE_EXTENSIONS[normalized];
|
|
447
|
+
if (known)
|
|
448
|
+
return known;
|
|
449
|
+
const subtype = (_a = normalized.split('/')[1]) !== null && _a !== void 0 ? _a : '';
|
|
450
|
+
return /^[a-z0-9]+$/.test(subtype) ? subtype : 'bin';
|
|
451
|
+
}
|
|
452
|
+
// Decode a base64 string to bytes in both Node (Buffer) and the browser (atob).
|
|
453
|
+
// Mammoth's `image.read('base64')` is the one encoding available in every build.
|
|
454
|
+
function base64ToBytes(b64) {
|
|
455
|
+
if (typeof Buffer !== 'undefined') {
|
|
456
|
+
return new Uint8Array(Buffer.from(b64, 'base64'));
|
|
457
|
+
}
|
|
458
|
+
const binary = atob(b64);
|
|
459
|
+
const bytes = new Uint8Array(binary.length);
|
|
460
|
+
for (let i = 0; i < binary.length; i++)
|
|
461
|
+
bytes[i] = binary.charCodeAt(i);
|
|
462
|
+
return bytes;
|
|
463
|
+
}
|
|
464
|
+
// Build a Mammoth `convertImage` handler that pulls each image out into a byte
|
|
465
|
+
// array with a deterministic relative path (`imageDir/imageN.ext`) instead of
|
|
466
|
+
// inlining it as a base64 data URI. The collected images are exposed on the
|
|
467
|
+
// returned `images` array once conversion finishes.
|
|
468
|
+
function createImageExtractor(imageDir) {
|
|
469
|
+
const images = [];
|
|
470
|
+
const convertImage = mammoth.images.imgElement((image) => __awaiter(this, void 0, void 0, function* () {
|
|
471
|
+
const bytes = base64ToBytes(yield image.read('base64'));
|
|
472
|
+
const ext = extensionForContentType(image.contentType);
|
|
473
|
+
const path = `${imageDir}/image${images.length + 1}.${ext}`;
|
|
474
|
+
images.push({ path, contentType: image.contentType, bytes });
|
|
475
|
+
return { src: path };
|
|
476
|
+
}));
|
|
477
|
+
return { images, convertImage };
|
|
478
|
+
}
|
|
479
|
+
// The shared conversion pipeline: mammoth HTML -> cleaned, formatted Markdown.
|
|
480
|
+
// Returns mammoth's messages so callers can surface content-loss warnings, and
|
|
481
|
+
// (in extract mode) the extracted image assets.
|
|
482
|
+
function runConversionPipeline(mammothInput, options) {
|
|
483
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
484
|
+
var _a;
|
|
485
|
+
// Preserving underline requires cooperation at both ends of the pipeline:
|
|
486
|
+
// Mammoth must be told to emit `<u>` (it drops underlines by default), and
|
|
487
|
+
// Turndown must be told to keep that tag rather than flatten it to text.
|
|
488
|
+
const preserveUnderline = options.underline === 'preserve';
|
|
489
|
+
let mammothOptions = preserveUnderline
|
|
490
|
+
? withUnderlineStyleMap(options.mammoth)
|
|
491
|
+
: options.mammoth;
|
|
492
|
+
// Extract mode swaps Mammoth's default base64 inliner for a collector that
|
|
493
|
+
// returns each image's bytes and rewrites the src to a relative path.
|
|
494
|
+
let extractor;
|
|
495
|
+
if (options.images === 'extract') {
|
|
496
|
+
extractor = createImageExtractor((_a = options.imageDir) !== null && _a !== void 0 ? _a : 'images');
|
|
497
|
+
mammothOptions = Object.assign(Object.assign({}, mammothOptions), { convertImage: extractor.convertImage });
|
|
498
|
+
}
|
|
499
|
+
const mammothResult = yield mammoth.convertToHtml(mammothInput, mammothOptions);
|
|
500
|
+
const processedHtml = processHtml(mammothResult.value, {
|
|
501
|
+
stripImages: options.images === 'strip',
|
|
502
|
+
});
|
|
503
|
+
const md = htmlToMd(processedHtml, options.turndown, preserveUnderline ? ['u'] : []);
|
|
504
|
+
// Numbered lists stay numbered by default; flatten to bullets on request.
|
|
505
|
+
const listMd = options.numberedLists === 'bullets'
|
|
506
|
+
? convertNumberedListsToBullets(md)
|
|
507
|
+
: md;
|
|
508
|
+
const normalizedMd = normalizeText(listMd);
|
|
509
|
+
const cleanedMd = lint(normalizedMd);
|
|
510
|
+
const formattedMd = yield prettify(cleanedMd);
|
|
511
|
+
return {
|
|
512
|
+
markdown: formattedMd,
|
|
513
|
+
messages: mammothResult.messages,
|
|
514
|
+
images: extractor === null || extractor === void 0 ? void 0 : extractor.images,
|
|
515
|
+
};
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
// Substrings (lower-cased) that, in a thrown error's message, indicate the
|
|
519
|
+
// input isn't a readable .docx (invalid/corrupt/truncated ZIP, or a missing
|
|
520
|
+
// required part). Sourced from JSZip and mammoth, which throw untyped Errors.
|
|
521
|
+
const INVALID_DOCX_ERROR_PATTERNS = [
|
|
522
|
+
'end of central directory', // JSZip: invalid ZIP structure
|
|
523
|
+
'zip file', // JSZip: not a valid ZIP
|
|
524
|
+
'corrupted zip', // JSZip: corrupted ZIP file
|
|
525
|
+
'end of data reached', // JSZip: truncated file
|
|
526
|
+
'could not find file', // mammoth: missing required file in .docx
|
|
527
|
+
];
|
|
528
|
+
function isInvalidDocxError(message) {
|
|
529
|
+
const lower = message.toLowerCase();
|
|
530
|
+
return INVALID_DOCX_ERROR_PATTERNS.some((pattern) => lower.includes(pattern));
|
|
531
|
+
}
|
|
532
|
+
// Translate the errors thrown by the pipeline into our typed, user-facing
|
|
533
|
+
// error classes. Always throws (never returns normally).
|
|
534
|
+
function classifyConversionError(error, filePath) {
|
|
535
|
+
// Re-throw our custom errors as-is
|
|
536
|
+
if (error instanceof UnsupportedFileError ||
|
|
537
|
+
error instanceof FileNotFoundError ||
|
|
538
|
+
error instanceof InvalidFileError ||
|
|
539
|
+
error instanceof FilePermissionError ||
|
|
540
|
+
error instanceof ConversionError) {
|
|
541
|
+
throw error;
|
|
542
|
+
}
|
|
543
|
+
// Handle specific error types from underlying libraries
|
|
544
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
545
|
+
const errorCode = error && typeof error === 'object' && 'code' in error
|
|
546
|
+
? error.code
|
|
547
|
+
: undefined;
|
|
548
|
+
// File not found errors (only occur with file path inputs)
|
|
549
|
+
if (errorCode === 'ENOENT') {
|
|
550
|
+
throw new FileNotFoundError(filePath);
|
|
551
|
+
}
|
|
552
|
+
// Permission errors (only occur with file path inputs)
|
|
553
|
+
if (errorCode === 'EACCES' || errorCode === 'EPERM') {
|
|
554
|
+
throw new FilePermissionError(filePath);
|
|
555
|
+
}
|
|
556
|
+
// Invalid .docx file errors (from JSZip or mammoth during file parsing).
|
|
557
|
+
// JSZip/mammoth throw plain, untyped Errors with no error code, so message
|
|
558
|
+
// matching is the only signal available. Matching is case-insensitive so a
|
|
559
|
+
// minor wording/capitalization change upstream is less likely to slip through
|
|
560
|
+
// (see INVALID_DOCX_ERROR_PATTERNS). There is a small theoretical risk of
|
|
561
|
+
// matching document content, but these technical phrases are highly unlikely
|
|
562
|
+
// to appear in normal content.
|
|
563
|
+
if (isInvalidDocxError(errorMessage)) {
|
|
564
|
+
// Note: For ArrayBuffer inputs (e.g., web uploads), filePath will be
|
|
565
|
+
// undefined, so the message won't include the original filename.
|
|
566
|
+
throw new InvalidFileError(filePath);
|
|
567
|
+
}
|
|
568
|
+
// Wrap other errors with a general conversion error
|
|
569
|
+
throw new ConversionError('An error occurred while converting the document. Please ensure the file is a valid .docx file and try again.', error instanceof Error ? error : undefined);
|
|
570
|
+
}
|
|
571
|
+
// Turn mammoth's conversion messages into user-facing warnings. Mammoth is
|
|
572
|
+
// chatty and emits many cosmetic "unrecognised style" notices on ordinary
|
|
573
|
+
// documents; we surface only messages that indicate actual content loss
|
|
574
|
+
// (dropped/ignored elements or unconvertible images), de-duplicated.
|
|
575
|
+
export function extractMammothWarnings(messages) {
|
|
576
|
+
const seen = new Set();
|
|
577
|
+
const warnings = [];
|
|
578
|
+
for (const message of messages) {
|
|
579
|
+
if (message.type !== 'warning' && message.type !== 'error') {
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
const text = message.message.toLowerCase();
|
|
583
|
+
// Skip cosmetic style-mapping notices — they don't drop content
|
|
584
|
+
if (text.includes('style')) {
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
// Surface only messages that signal dropped or unconvertible content
|
|
588
|
+
const indicatesContentLoss = text.includes('ignored') ||
|
|
589
|
+
text.includes('unsupported') ||
|
|
590
|
+
text.includes('could not') ||
|
|
591
|
+
text.includes('image');
|
|
592
|
+
if (!indicatesContentLoss) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
const warning = `Warning: Some document content may not have converted cleanly (${message.message}).`;
|
|
596
|
+
if (!seen.has(warning)) {
|
|
597
|
+
seen.add(warning);
|
|
598
|
+
warnings.push(warning);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
return warnings;
|
|
602
|
+
}
|
|
395
603
|
// Converts a Word document to crisp, clean Markdown with warnings
|
|
396
604
|
export function convertWithWarnings(input_1) {
|
|
397
605
|
return __awaiter(this, arguments, void 0, function* (input, options = {}) {
|
|
@@ -406,24 +614,10 @@ export function convertWithWarnings(input_1) {
|
|
|
406
614
|
validateFileExtension(input);
|
|
407
615
|
// Validate the file path to prevent path traversal attacks
|
|
408
616
|
const safePath = validateFilePath(input);
|
|
409
|
-
// Read the file once and share the buffer between
|
|
410
|
-
//
|
|
411
|
-
// redundant disk reads for large documents
|
|
617
|
+
// Read the file once and share the buffer between property extraction
|
|
618
|
+
// and Mammoth conversion to avoid redundant disk reads for large documents
|
|
412
619
|
const fileBuffer = yield fs.readFile(safePath);
|
|
413
|
-
|
|
414
|
-
// Ensure we have an ArrayBuffer (not SharedArrayBuffer) for property extraction
|
|
415
|
-
let arrayBuffer;
|
|
416
|
-
if (slicedBuffer instanceof ArrayBuffer) {
|
|
417
|
-
arrayBuffer = slicedBuffer;
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
// Convert SharedArrayBuffer to ArrayBuffer by copying the data
|
|
421
|
-
const uint8Array = new Uint8Array(slicedBuffer);
|
|
422
|
-
const newArrayBuffer = new ArrayBuffer(uint8Array.byteLength);
|
|
423
|
-
new Uint8Array(newArrayBuffer).set(uint8Array);
|
|
424
|
-
arrayBuffer = newArrayBuffer;
|
|
425
|
-
}
|
|
426
|
-
propertiesInput = arrayBuffer;
|
|
620
|
+
propertiesInput = toArrayBuffer(fileBuffer.buffer.slice(fileBuffer.byteOffset, fileBuffer.byteOffset + fileBuffer.byteLength));
|
|
427
621
|
mammothInput = { buffer: fileBuffer };
|
|
428
622
|
}
|
|
429
623
|
else {
|
|
@@ -440,119 +634,39 @@ export function convertWithWarnings(input_1) {
|
|
|
440
634
|
// Extract document properties to check for confidentiality flags
|
|
441
635
|
const properties = yield extractDocumentProperties(propertiesInput);
|
|
442
636
|
const warnings = generateWarnings(properties);
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
const mdWithBullets = convertNumberedListsToBullets(md);
|
|
447
|
-
const normalizedMd = normalizeText(mdWithBullets);
|
|
448
|
-
const cleanedMd = lint(normalizedMd);
|
|
449
|
-
const formattedMd = yield prettify(cleanedMd);
|
|
450
|
-
return {
|
|
451
|
-
markdown: formattedMd,
|
|
452
|
-
warnings,
|
|
453
|
-
};
|
|
637
|
+
const { markdown, messages, images } = yield runConversionPipeline(mammothInput, options);
|
|
638
|
+
warnings.push(...extractMammothWarnings(messages));
|
|
639
|
+
return images ? { markdown, warnings, images } : { markdown, warnings };
|
|
454
640
|
}
|
|
455
641
|
catch (error) {
|
|
456
|
-
|
|
457
|
-
if (error instanceof UnsupportedFileError ||
|
|
458
|
-
error instanceof FileNotFoundError ||
|
|
459
|
-
error instanceof InvalidFileError ||
|
|
460
|
-
error instanceof FilePermissionError ||
|
|
461
|
-
error instanceof ConversionError) {
|
|
462
|
-
throw error;
|
|
463
|
-
}
|
|
464
|
-
// Handle specific error types from underlying libraries
|
|
465
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
466
|
-
const errorCode = error && typeof error === 'object' && 'code' in error
|
|
467
|
-
? error.code
|
|
468
|
-
: undefined;
|
|
469
|
-
// File not found errors (only occur with file path inputs)
|
|
470
|
-
if (errorCode === 'ENOENT') {
|
|
471
|
-
throw new FileNotFoundError(filePath);
|
|
472
|
-
}
|
|
473
|
-
// Permission errors (only occur with file path inputs)
|
|
474
|
-
if (errorCode === 'EACCES' || errorCode === 'EPERM') {
|
|
475
|
-
throw new FilePermissionError(filePath);
|
|
476
|
-
}
|
|
477
|
-
// Invalid .docx file errors (from JSZip or mammoth during file parsing)
|
|
478
|
-
if (errorMessage.includes('end of central directory') ||
|
|
479
|
-
errorMessage.includes('zip file') ||
|
|
480
|
-
errorMessage.includes('Corrupted zip') ||
|
|
481
|
-
errorMessage.includes('End of data reached') ||
|
|
482
|
-
errorMessage.includes('Could not find file')) {
|
|
483
|
-
throw new InvalidFileError(filePath);
|
|
484
|
-
}
|
|
485
|
-
// Wrap other errors with a general conversion error
|
|
486
|
-
throw new ConversionError('An error occurred while converting the document. Please ensure the file is a valid .docx file and try again.', error instanceof Error ? error : undefined);
|
|
642
|
+
classifyConversionError(error, filePath);
|
|
487
643
|
}
|
|
488
644
|
});
|
|
489
645
|
}
|
|
490
|
-
// Converts a Word document to crisp, clean Markdown
|
|
646
|
+
// Converts a Word document to crisp, clean Markdown.
|
|
647
|
+
// Unlike convertWithWarnings, this skips document-property extraction (and its
|
|
648
|
+
// extra ZIP parse) so callers that only need the Markdown pay no overhead.
|
|
491
649
|
export default function convert(input_1) {
|
|
492
650
|
return __awaiter(this, arguments, void 0, function* (input, options = {}) {
|
|
493
|
-
let inputObj;
|
|
494
651
|
let filePath;
|
|
495
652
|
try {
|
|
653
|
+
let mammothInput;
|
|
496
654
|
if (typeof input === 'string') {
|
|
497
655
|
filePath = input;
|
|
498
656
|
// Validate file extension for file path inputs
|
|
499
657
|
validateFileExtension(input);
|
|
500
658
|
// Validate the file path to prevent path traversal attacks
|
|
501
659
|
const safePath = validateFilePath(input);
|
|
502
|
-
|
|
660
|
+
mammothInput = { path: safePath };
|
|
503
661
|
}
|
|
504
662
|
else {
|
|
505
|
-
|
|
663
|
+
mammothInput = { arrayBuffer: input };
|
|
506
664
|
}
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
const md = htmlToMd(processedHtml, options.turndown);
|
|
510
|
-
const mdWithBullets = convertNumberedListsToBullets(md);
|
|
511
|
-
const normalizedMd = normalizeText(mdWithBullets);
|
|
512
|
-
const cleanedMd = lint(normalizedMd);
|
|
513
|
-
const formattedMd = yield prettify(cleanedMd);
|
|
514
|
-
return formattedMd;
|
|
665
|
+
const { markdown } = yield runConversionPipeline(mammothInput, options);
|
|
666
|
+
return markdown;
|
|
515
667
|
}
|
|
516
668
|
catch (error) {
|
|
517
|
-
|
|
518
|
-
if (error instanceof UnsupportedFileError ||
|
|
519
|
-
error instanceof FileNotFoundError ||
|
|
520
|
-
error instanceof InvalidFileError ||
|
|
521
|
-
error instanceof FilePermissionError ||
|
|
522
|
-
error instanceof ConversionError) {
|
|
523
|
-
throw error;
|
|
524
|
-
}
|
|
525
|
-
// Handle specific error types from underlying libraries
|
|
526
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
527
|
-
const errorCode = error && typeof error === 'object' && 'code' in error
|
|
528
|
-
? error.code
|
|
529
|
-
: undefined;
|
|
530
|
-
// File not found errors (only occur with file path inputs)
|
|
531
|
-
if (errorCode === 'ENOENT') {
|
|
532
|
-
throw new FileNotFoundError(filePath);
|
|
533
|
-
}
|
|
534
|
-
// Permission errors (only occur with file path inputs)
|
|
535
|
-
if (errorCode === 'EACCES' || errorCode === 'EPERM') {
|
|
536
|
-
throw new FilePermissionError(filePath);
|
|
537
|
-
}
|
|
538
|
-
// Invalid .docx file errors (from JSZip or mammoth during file parsing)
|
|
539
|
-
// These patterns typically come from JSZip/mammoth when parsing the file structure.
|
|
540
|
-
// While there's a small theoretical risk of matching document content in unusual
|
|
541
|
-
// scenarios (e.g., embedded error messages), these specific technical phrases are
|
|
542
|
-
// highly unlikely to appear in normal document content.
|
|
543
|
-
if (errorMessage.includes('end of central directory') || // JSZip: invalid ZIP structure
|
|
544
|
-
errorMessage.includes('zip file') || // JSZip: not a valid ZIP
|
|
545
|
-
errorMessage.includes('Corrupted zip') || // JSZip: corrupted ZIP file
|
|
546
|
-
errorMessage.includes('End of data reached') || // JSZip: truncated file
|
|
547
|
-
errorMessage.includes('Could not find file') // mammoth: missing required file in .docx
|
|
548
|
-
) {
|
|
549
|
-
// Note: For ArrayBuffer inputs (e.g., web uploads), filePath will be undefined,
|
|
550
|
-
// so the error message won't include the original filename. The web interface
|
|
551
|
-
// could be enhanced to pass the filename separately if needed.
|
|
552
|
-
throw new InvalidFileError(filePath);
|
|
553
|
-
}
|
|
554
|
-
// Wrap other errors with a general conversion error
|
|
555
|
-
throw new ConversionError('An error occurred while converting the document. Please ensure the file is a valid .docx file and try again.', error instanceof Error ? error : undefined);
|
|
669
|
+
classifyConversionError(error, filePath);
|
|
556
670
|
}
|
|
557
671
|
});
|
|
558
672
|
}
|
package/build/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAAA,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,iBAAiB,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAmBxB,kDAAkD;AAClD,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,wCAAwC;AACxC,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,QAAiB;QAC3B,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CA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AAM,qBAAqB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YACxE,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "word-to-markdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Convert Word documents to beautiful Markdown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@tailwindcss/vite": "^4.3.3",
|
|
35
35
|
"@types/jest": "~30.0",
|
|
36
36
|
"@types/node": "~26",
|
|
37
|
-
"@types/turndown": "^5.0.6",
|
|
38
37
|
"astro": "^7.1.3",
|
|
38
|
+
"clipboard": "^2.0.11",
|
|
39
39
|
"eslint": "^10.7.0",
|
|
40
40
|
"eslint-config-prettier": "~10.1",
|
|
41
41
|
"eslint-plugin-jest": "~29.15",
|
|
@@ -43,11 +43,17 @@
|
|
|
43
43
|
"jest": "~30.4",
|
|
44
44
|
"jest-util": "~30.4",
|
|
45
45
|
"playwright": "^1.61.1",
|
|
46
|
+
"rehype-sanitize": "^6.0.0",
|
|
47
|
+
"rehype-stringify": "^10.0.1",
|
|
48
|
+
"remark-gfm": "^4.0.1",
|
|
49
|
+
"remark-parse": "^11.0.0",
|
|
50
|
+
"remark-rehype": "^11.1.2",
|
|
46
51
|
"tailwindcss": "^4.3.3",
|
|
47
52
|
"ts-api-utils": "~2.5",
|
|
48
53
|
"ts-jest": "~29.4",
|
|
49
54
|
"typescript": "^6.0.3",
|
|
50
|
-
"typescript-eslint": "^8.65.0"
|
|
55
|
+
"typescript-eslint": "^8.65.0",
|
|
56
|
+
"unified": "^11.0.5"
|
|
51
57
|
},
|
|
52
58
|
"scripts": {
|
|
53
59
|
"fix": "eslint --fix . && prettier --write .",
|
|
@@ -70,21 +76,13 @@
|
|
|
70
76
|
"dependencies": {
|
|
71
77
|
"@joplin/turndown": "^4.0.85",
|
|
72
78
|
"@joplin/turndown-plugin-gfm": "^1.0.67",
|
|
73
|
-
"clipboard": "^2.0.11",
|
|
74
79
|
"commander": "^15.0.0",
|
|
75
80
|
"jszip": "^3.10.1",
|
|
76
81
|
"mammoth": "^1.12.0",
|
|
77
82
|
"markdownlint": "^0.41.1",
|
|
78
83
|
"node-html-parser": "^9.0.0",
|
|
79
84
|
"prettier": "~3.9",
|
|
80
|
-
"
|
|
81
|
-
"rehype-stringify": "^10.0.1",
|
|
82
|
-
"remark-gfm": "^4.0.1",
|
|
83
|
-
"remark-parse": "^11.0.0",
|
|
84
|
-
"remark-rehype": "^11.1.2",
|
|
85
|
-
"tslib": "~2.8",
|
|
86
|
-
"unified": "^11.0.5",
|
|
87
|
-
"url": "^0.11.4"
|
|
85
|
+
"tslib": "~2.8"
|
|
88
86
|
},
|
|
89
87
|
"volta": {
|
|
90
88
|
"node": "22.13.0"
|