@adobe/helix-docx2md 1.6.29 → 1.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.7.0](https://github.com/adobe/helix-docx2md/compare/v1.6.29...v1.7.0) (2025-08-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * add image upload error listener ([#692](https://github.com/adobe/helix-docx2md/issues/692)) ([18d450e](https://github.com/adobe/helix-docx2md/commit/18d450e833523f45599ab0c576a915f61f74caa5))
7
+
1
8
  ## [1.6.29](https://github.com/adobe/helix-docx2md/compare/v1.6.28...v1.6.29) (2025-06-18)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-docx2md",
3
- "version": "1.6.29",
3
+ "version": "1.7.0",
4
4
  "description": "Helix library that converts word documents to markdown",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -52,24 +52,24 @@
52
52
  "yauzl": "3.2.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@adobe/eslint-config-helix": "3.0.4",
56
- "@adobe/helix-admin-support": "3.3.7",
57
- "@adobe/helix-mediahandler": "2.7.11",
58
- "@adobe/helix-onedrive-support": "12.0.19",
55
+ "@adobe/eslint-config-helix": "3.0.9",
56
+ "@adobe/helix-admin-support": "3.3.18",
57
+ "@adobe/helix-mediahandler": "2.8.1",
58
+ "@adobe/helix-onedrive-support": "12.0.28",
59
59
  "@adobe/helix-shared-tokencache": "1.5.0",
60
- "@eslint/config-helpers": "0.2.3",
60
+ "@eslint/config-helpers": "0.3.1",
61
61
  "@semantic-release/changelog": "6.0.3",
62
62
  "@semantic-release/exec": "7.1.0",
63
63
  "@semantic-release/git": "10.0.1",
64
64
  "c8": "10.1.3",
65
- "dotenv": "16.5.0",
65
+ "dotenv": "17.2.1",
66
66
  "eslint": "9.4.0",
67
67
  "husky": "9.1.7",
68
68
  "junit-report-builder": "5.1.1",
69
- "lint-staged": "16.1.2",
70
- "mocha": "11.6.0",
69
+ "lint-staged": "16.1.5",
70
+ "mocha": "11.7.1",
71
71
  "mocha-multi-reporters": "1.5.1",
72
- "semantic-release": "24.2.5",
72
+ "semantic-release": "24.2.7",
73
73
  "unist-util-inspect": "8.1.0"
74
74
  },
75
75
  "lint-staged": {
package/src/docx2md.d.ts CHANGED
@@ -35,6 +35,9 @@ declare interface Logger {}
35
35
  *
36
36
  * @event afterToMarkdown
37
37
  * @property {string} md resulting markdown
38
+ *
39
+ * @event onImageUploadError
40
+ * @property {Error} e the error
38
41
  */
39
42
 
40
43
  /**
@@ -60,8 +60,9 @@ async function getBlob(handler, data, contentType, source) {
60
60
  * @param {object} tree
61
61
  * @param {MediaHandler} blobHandler
62
62
  * @param {string} source the source document
63
+ * @param {Docx2mdListener} listener
63
64
  */
64
- export default async function processImages(log, tree, blobHandler, source) {
65
+ export default async function processImages(log, tree, blobHandler, source, listener) {
65
66
  // gather all image nodes
66
67
  const images = [];
67
68
 
@@ -88,6 +89,9 @@ export default async function processImages(log, tree, blobHandler, source) {
88
89
  const data = await node.readAsBuffer();
89
90
  blob = await getBlob(blobHandler, data, node.contentType, source);
90
91
  } catch (e) {
92
+ if (listener) {
93
+ listener('onImageUploadError', e);
94
+ }
91
95
  log.error('Error reading blob data:', e.message);
92
96
  node.url = 'about:error';
93
97
  return;
@@ -22,7 +22,7 @@ import { find } from 'unist-util-find';
22
22
  * │ └─0 text "All 50+ Adobe apps explained in 10 minutes"
23
23
  * └─9 paragraph[1]
24
24
  * └─0 image
25
- * url: "https://ref--repo--owner.hlx.page/media_22205a4de0c419213733ecab0b0bd555257e9e5c#image.jpg"
25
+ * url: "https://ref--repo--owner.aem.page/media_22205a4de0c419213733ecab0b0bd555257e9e5c#image.jpg"
26
26
  * alt: "Video titled: All 50+ Adobe apps explained in 10 minutes"
27
27
  *
28
28
  * alternative / new format
@@ -74,7 +74,7 @@ export default async function mdast2md(mdast, opts = {}) {
74
74
  await sanitizeTextAndFormats(mdast);
75
75
  await suppressSpaceCode(mdast);
76
76
  await sanitizeAutoEmbeds(mdast);
77
- await processImages(log, mdast, opts.mediaHandler, opts.source);
77
+ await processImages(log, mdast, opts.mediaHandler, opts.source, listener);
78
78
  await imageReferences(mdast);
79
79
  processor.use(remarkGridTable);
80
80
  } else {