@adobe/helix-docx2md 1.6.1 → 1.6.3
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 +14 -0
- package/package.json +6 -6
- package/src/dast2mdast/dast2mdast.js +6 -4
- package/src/docx2dast/zipfile.js +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.6.3](https://github.com/adobe/helix-docx2md/compare/v1.6.2...v1.6.3) (2024-07-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* render broken bookmark links (anchors) ([#487](https://github.com/adobe/helix-docx2md/issues/487)) ([597e5cd](https://github.com/adobe/helix-docx2md/commit/597e5cdf9dc769d0b46f4b99318484af18eb8a31))
|
|
7
|
+
|
|
8
|
+
## [1.6.2](https://github.com/adobe/helix-docx2md/compare/v1.6.1...v1.6.2) (2024-06-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* resolve relationships correctly ([#482](https://github.com/adobe/helix-docx2md/issues/482)) ([5625564](https://github.com/adobe/helix-docx2md/commit/5625564a7d1be2b1c650e46784225f1c075db8fd))
|
|
14
|
+
|
|
1
15
|
## [1.6.1](https://github.com/adobe/helix-docx2md/compare/v1.6.0...v1.6.1) (2024-06-22)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-docx2md",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "Helix library that converts word documents to markdown",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@adobe/eslint-config-helix": "2.0.6",
|
|
56
|
-
"@adobe/helix-admin-support": "2.8.
|
|
57
|
-
"@adobe/helix-mediahandler": "2.5.
|
|
58
|
-
"@adobe/helix-onedrive-support": "11.3.
|
|
59
|
-
"@adobe/helix-shared-tokencache": "1.4.
|
|
56
|
+
"@adobe/helix-admin-support": "2.8.19",
|
|
57
|
+
"@adobe/helix-mediahandler": "2.5.12",
|
|
58
|
+
"@adobe/helix-onedrive-support": "11.3.38",
|
|
59
|
+
"@adobe/helix-shared-tokencache": "1.4.16",
|
|
60
60
|
"@semantic-release/changelog": "6.0.3",
|
|
61
61
|
"@semantic-release/exec": "6.0.3",
|
|
62
62
|
"@semantic-release/git": "10.0.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"husky": "9.0.11",
|
|
67
67
|
"junit-report-builder": "3.2.1",
|
|
68
68
|
"lint-staged": "15.2.7",
|
|
69
|
-
"mocha": "10.
|
|
69
|
+
"mocha": "10.5.2",
|
|
70
70
|
"mocha-multi-reporters": "1.5.1",
|
|
71
71
|
"semantic-release": "24.0.0",
|
|
72
72
|
"unist-util-inspect": "8.0.0"
|
|
@@ -104,11 +104,13 @@ export default async function dast2mdast(tree, opts = {}) {
|
|
|
104
104
|
const slugger = new IDSlugger();
|
|
105
105
|
for (const bm of bookmarks) {
|
|
106
106
|
if (!bm.target) {
|
|
107
|
-
if (bm.name
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
if (bm.name === '_top') {
|
|
108
|
+
bm.id = '';
|
|
109
|
+
} else {
|
|
110
|
+
// link to "broken" bookmark. this happens if the author enters a `#anchor` link.
|
|
111
|
+
// we just use the name (i.e. the anchor) as the id.
|
|
112
|
+
bm.id = bm.name;
|
|
110
113
|
}
|
|
111
|
-
bm.id = '';
|
|
112
114
|
} else if (bm.target.type === 'heading') {
|
|
113
115
|
// if heading, create an ID from its text
|
|
114
116
|
if (!bm.target.id) {
|
package/src/docx2dast/zipfile.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import yauzl from 'yauzl';
|
|
13
13
|
import promises from '@adobe/mammoth/lib/promises.js';
|
|
14
14
|
import { joinPath, splitPath } from '@adobe/mammoth/lib/zipfile.js';
|
|
15
|
+
import path from 'path';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Custom implementation of zipfiles, supporting streaming.
|
|
@@ -34,12 +35,16 @@ export function openArrayBuffer(arrayBuffer) {
|
|
|
34
35
|
entries.set(entry.fileName, entry);
|
|
35
36
|
});
|
|
36
37
|
|
|
38
|
+
function getEntry(name) {
|
|
39
|
+
return entries.get(path.join(name));
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
function exists(name) {
|
|
38
|
-
return
|
|
43
|
+
return !!getEntry(name);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
function read(name, encoding, asContentSource) {
|
|
42
|
-
const entry =
|
|
47
|
+
const entry = getEntry(name);
|
|
43
48
|
if (!entry) {
|
|
44
49
|
return promises.reject(Error(`No such file ${name}`));
|
|
45
50
|
}
|