@adobe/helix-md2docx 2.0.28 → 2.0.29

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
+ ## [2.0.29](https://github.com/adobe/helix-md2docx/compare/v2.0.28...v2.0.29) (2023-01-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency hast-util-to-mdast to v9 ([#198](https://github.com/adobe/helix-md2docx/issues/198)) ([6d35b71](https://github.com/adobe/helix-md2docx/commit/6d35b7142b012dc28d5ee01894a6cbb8b5e5698b))
7
+
1
8
  ## [2.0.28](https://github.com/adobe/helix-md2docx/compare/v2.0.27...v2.0.28) (2023-01-07)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-md2docx",
3
- "version": "2.0.28",
3
+ "version": "2.0.29",
4
4
  "description": "Helix Service that converts markdown to word documents",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "@adobe/remark-gridtables": "1.0.0",
35
35
  "docx": "7.8.2",
36
36
  "hast-util-is-element": "2.1.3",
37
- "hast-util-to-mdast": "8.4.1",
37
+ "hast-util-to-mdast": "9.0.0",
38
38
  "image-size": "1.0.2",
39
39
  "mime": "3.0.0",
40
40
  "rehype-parse": "8.0.4",
@@ -45,22 +45,22 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@adobe/eslint-config-helix": "1.3.2",
48
- "@adobe/helix-mediahandler": "1.2.24",
48
+ "@adobe/helix-mediahandler": "2.0.1",
49
49
  "@semantic-release/changelog": "6.0.2",
50
50
  "@semantic-release/exec": "6.0.3",
51
51
  "@semantic-release/git": "10.0.1",
52
52
  "c8": "7.12.0",
53
53
  "dotenv": "16.0.3",
54
54
  "eslint": "8.31.0",
55
- "eslint-import-resolver-exports": "1.0.0-beta.3",
55
+ "eslint-import-resolver-exports": "1.0.0-beta.4",
56
56
  "eslint-plugin-header": "3.1.1",
57
- "eslint-plugin-import": "2.26.0",
57
+ "eslint-plugin-import": "2.27.4",
58
58
  "husky": "8.0.3",
59
59
  "junit-report-builder": "3.0.1",
60
60
  "lint-staged": "13.1.0",
61
61
  "mocha": "10.2.0",
62
62
  "mocha-multi-reporters": "1.5.1",
63
- "nock": "13.2.9",
63
+ "nock": "13.3.0",
64
64
  "semantic-release": "19.0.5",
65
65
  "unist-util-inspect": "7.0.1",
66
66
  "yauzl": "2.10.0"
@@ -17,15 +17,17 @@
17
17
 
18
18
  'use strict';
19
19
 
20
- import { all } from 'hast-util-to-mdast/lib/all.js';
21
-
22
- export default function cell(h, node) {
23
- const wrap = h.wrapText;
20
+ export default function cell(state, node) {
21
+ const wrap = state.wrapText;
24
22
 
25
23
  // eslint-disable-next-line no-param-reassign
26
- h.wrapText = false;
24
+ state.wrapText = false;
27
25
 
28
- const result = h(node, 'tableCell', all(h, node));
26
+ const result = {
27
+ type: 'tableCell',
28
+ children: state.all(node),
29
+ };
30
+ state.patch(node, result);
29
31
 
30
32
  if (node.properties?.rowSpan || node.properties?.colSpan || node.properties?.align) {
31
33
  const data = result.data || (result.data = {});
@@ -40,7 +42,7 @@ export default function cell(h, node) {
40
42
  }
41
43
  }
42
44
  // eslint-disable-next-line no-param-reassign
43
- h.wrapText = wrap;
45
+ state.wrapText = wrap;
44
46
 
45
47
  return result;
46
48
  }
@@ -12,8 +12,6 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- import { all } from 'hast-util-to-mdast/lib/all.js';
16
-
17
15
  /*
18
16
  copied and adapted from
19
17
  https://github.com/syntax-tree/hast-util-to-mdast/blob/main/lib/handlers/table.js
@@ -87,14 +85,16 @@ function toRows(children) {
87
85
  return nodes;
88
86
  }
89
87
 
90
- export default function table(h, node) {
91
- const mdNode = h(node, 'table', toRows(all(h, node)));
92
-
93
- // clean up table in respect to row and colspan and compute alignments
94
- mdNode.align = [];
88
+ export default function table(state, node) {
89
+ const mdNode = {
90
+ type: 'table',
91
+ children: toRows(state.all(node)),
92
+ // clean up table in respect to row and colspan and compute alignments
93
+ align: [],
94
+ maxCols: 0,
95
+ };
95
96
 
96
97
  // compute the number of cells in each row, respecting the row and col spans.
97
- mdNode.maxCols = 0;
98
98
  const pendingRowSpans = [];
99
99
  for (const row of mdNode.children) {
100
100
  row.numCols = pendingRowSpans.shift() || 0;
@@ -22,7 +22,7 @@ import tableCellHandler from './hast-table-cell-handler.js';
22
22
  * @param type
23
23
  */
24
24
  function formatHandler(type) {
25
- return (h, node) => h(node, type, node.children);
25
+ return (state, { children }) => ({ type, children });
26
26
  }
27
27
 
28
28
  /**
@@ -30,7 +30,7 @@ function formatHandler(type) {
30
30
  * @param {[]} mdasts array of mdast sub trees
31
31
  */
32
32
  function mdHandler(mdasts) {
33
- return (h, node) => {
33
+ return (state, node) => {
34
34
  const { idx } = node.properties;
35
35
  return mdasts[idx];
36
36
  };