@adobe/helix-md2docx 2.1.76 → 2.1.78
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/mdast2docx/mdast-docx-anchors.js +17 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.1.78](https://github.com/adobe/helix-md2docx/compare/v2.1.77...v2.1.78) (2024-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* don't create bookmarks if heading is not referenced ([656e792](https://github.com/adobe/helix-md2docx/commit/656e792d3f31a0731c72fac9583d370cbf3a2a5d)), closes [#492](https://github.com/adobe/helix-md2docx/issues/492)
|
|
7
|
+
|
|
8
|
+
## [2.1.77](https://github.com/adobe/helix-md2docx/compare/v2.1.76...v2.1.77) (2024-09-30)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-docx2md to v1.6.8 ([#488](https://github.com/adobe/helix-md2docx/issues/488)) ([8fbc36f](https://github.com/adobe/helix-md2docx/commit/8fbc36f5b5e76cb64453459f0d0137a11066c688))
|
|
14
|
+
|
|
1
15
|
## [2.1.76](https://github.com/adobe/helix-md2docx/compare/v2.1.75...v2.1.76) (2024-09-28)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-md2docx",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.78",
|
|
4
4
|
"description": "Helix Service that converts markdown to word documents",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"lint": "eslint .",
|
|
10
10
|
"semantic-release": "semantic-release",
|
|
11
11
|
"semantic-release-dry": "semantic-release --dry-run --branches $CI_BRANCH",
|
|
12
|
-
"prepare": "husky
|
|
12
|
+
"prepare": "husky"
|
|
13
13
|
},
|
|
14
14
|
"mocha": {
|
|
15
15
|
"spec": "test/*.test.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"homepage": "https://github.com/adobe/helix-md2docx#readme",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@adobe/fetch": "4.1.9",
|
|
32
|
-
"@adobe/helix-docx2md": "1.6.
|
|
32
|
+
"@adobe/helix-docx2md": "1.6.8",
|
|
33
33
|
"@adobe/helix-markdown-support": "7.1.6",
|
|
34
34
|
"@adobe/helix-shared-process-queue": "3.0.4",
|
|
35
35
|
"@adobe/remark-gridtables": "3.0.6",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"unist-util-visit": "5.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@adobe/eslint-config-helix": "2.0.
|
|
51
|
-
"@adobe/helix-mediahandler": "2.5.
|
|
50
|
+
"@adobe/eslint-config-helix": "2.0.8",
|
|
51
|
+
"@adobe/helix-mediahandler": "2.5.26",
|
|
52
52
|
"@semantic-release/changelog": "6.0.3",
|
|
53
53
|
"@semantic-release/exec": "6.0.3",
|
|
54
54
|
"@semantic-release/git": "10.0.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"eslint": "8.57.1",
|
|
58
58
|
"eslint-import-resolver-exports": "1.0.0-beta.5",
|
|
59
59
|
"eslint-plugin-header": "3.1.1",
|
|
60
|
-
"eslint-plugin-import": "2.
|
|
60
|
+
"eslint-plugin-import": "2.31.0",
|
|
61
61
|
"husky": "9.1.6",
|
|
62
62
|
"junit-report-builder": "5.1.1",
|
|
63
63
|
"lint-staged": "15.2.10",
|
|
@@ -46,7 +46,20 @@ export function buildAnchors(tree) {
|
|
|
46
46
|
const track = (url) => {
|
|
47
47
|
let ref = tracking[url];
|
|
48
48
|
if (!ref) {
|
|
49
|
-
ref = {
|
|
49
|
+
ref = {
|
|
50
|
+
/**
|
|
51
|
+
* links that use this `url`
|
|
52
|
+
*/
|
|
53
|
+
links: [],
|
|
54
|
+
/**
|
|
55
|
+
* heading that is anchored at this `url`
|
|
56
|
+
*/
|
|
57
|
+
heading: null,
|
|
58
|
+
/**
|
|
59
|
+
* bookmark that is anchored at this `url`
|
|
60
|
+
*/
|
|
61
|
+
bookmark: null,
|
|
62
|
+
};
|
|
50
63
|
tracking[url] = ref;
|
|
51
64
|
}
|
|
52
65
|
return ref;
|
|
@@ -75,7 +88,7 @@ export function buildAnchors(tree) {
|
|
|
75
88
|
const anchors = {};
|
|
76
89
|
Object.keys(tracking).forEach((k) => {
|
|
77
90
|
const ref = tracking[k];
|
|
78
|
-
if (ref.heading) {
|
|
91
|
+
if (ref.heading && ref.links.length) {
|
|
79
92
|
// ms-word heading bookmark algorithm
|
|
80
93
|
const words = toString(ref.heading).split(/\s+/).slice(0, 3);
|
|
81
94
|
let anchor = `_${words.join('_')}`.substring(0, 36);
|
|
@@ -88,8 +101,10 @@ export function buildAnchors(tree) {
|
|
|
88
101
|
}
|
|
89
102
|
anchors[anchor] = 0;
|
|
90
103
|
|
|
104
|
+
// remember word-specific anchor for heading
|
|
91
105
|
ref.heading.anchor = anchor;
|
|
92
106
|
for (const link of ref.links) {
|
|
107
|
+
// change links to reference word-specific anchor
|
|
93
108
|
link.anchor = anchor;
|
|
94
109
|
}
|
|
95
110
|
} else if (ref.bookmark) {
|