@adobe/helix-docx2md 1.4.21 → 1.5.1

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,17 @@
1
+ ## [1.5.1](https://github.com/adobe/helix-docx2md/compare/v1.5.0...v1.5.1) (2024-01-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update adobe major ([#391](https://github.com/adobe/helix-docx2md/issues/391)) ([a62ad92](https://github.com/adobe/helix-docx2md/commit/a62ad9248c28690c4e6e087971f35edbb495ad96))
7
+
8
+ # [1.5.0](https://github.com/adobe/helix-docx2md/compare/v1.4.21...v1.5.0) (2023-11-03)
9
+
10
+
11
+ ### Features
12
+
13
+ * Handle emdash character for section breaks ([c2c8495](https://github.com/adobe/helix-docx2md/commit/c2c84957bf7a8f47acf70035d08318f84ea12de8)), closes [#343](https://github.com/adobe/helix-docx2md/issues/343)
14
+
1
15
  ## [1.4.21](https://github.com/adobe/helix-docx2md/compare/v1.4.20...v1.4.21) (2023-10-28)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-docx2md",
3
- "version": "1.4.21",
3
+ "version": "1.5.1",
4
4
  "description": "Helix library that converts word documents to markdown",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -34,10 +34,10 @@
34
34
  "homepage": "https://github.com/adobe/helix-docx2md#readme",
35
35
  "dependencies": {
36
36
  "@adobe/helix-markdown-support": "7.1.0",
37
- "@adobe/helix-shared-process-queue": "3.0.0",
37
+ "@adobe/helix-shared-process-queue": "3.0.1",
38
38
  "@adobe/mammoth": "1.5.1-bleeding.2",
39
- "@adobe/mdast-util-gridtables": "3.0.2",
40
- "@adobe/remark-gridtables": "2.0.2",
39
+ "@adobe/mdast-util-gridtables": "4.0.0",
40
+ "@adobe/remark-gridtables": "3.0.0",
41
41
  "dirname-filename-esm": "1.1.1",
42
42
  "github-slugger": "2.0.0",
43
43
  "mdast-util-to-markdown": "2.1.0",
@@ -51,23 +51,23 @@
51
51
  "yauzl": "2.10.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@adobe/eslint-config-helix": "2.0.3",
55
- "@adobe/helix-admin-support": "2.2.18",
56
- "@adobe/helix-mediahandler": "2.2.20",
57
- "@adobe/helix-onedrive-support": "11.0.4",
58
- "@adobe/helix-shared-tokencache": "1.3.13",
54
+ "@adobe/eslint-config-helix": "2.0.5",
55
+ "@adobe/helix-admin-support": "2.3.16",
56
+ "@adobe/helix-mediahandler": "2.4.7",
57
+ "@adobe/helix-onedrive-support": "11.3.6",
58
+ "@adobe/helix-shared-tokencache": "1.3.23",
59
59
  "@semantic-release/changelog": "6.0.3",
60
60
  "@semantic-release/exec": "6.0.3",
61
61
  "@semantic-release/git": "10.0.1",
62
- "c8": "8.0.1",
63
- "dotenv": "16.3.1",
64
- "eslint": "8.52.0",
65
- "husky": "8.0.3",
62
+ "c8": "9.1.0",
63
+ "dotenv": "16.4.1",
64
+ "eslint": "8.56.0",
65
+ "husky": "9.0.7",
66
66
  "junit-report-builder": "3.1.0",
67
- "lint-staged": "15.0.2",
67
+ "lint-staged": "15.2.0",
68
68
  "mocha": "10.2.0",
69
69
  "mocha-multi-reporters": "1.5.1",
70
- "semantic-release": "22.0.5",
70
+ "semantic-release": "22.0.12",
71
71
  "unist-util-inspect": "8.0.0"
72
72
  },
73
73
  "lint-staged": {
@@ -39,6 +39,11 @@ const HEADING_MAP = {
39
39
  'heading 8': 8,
40
40
  };
41
41
 
42
+ function isHorizontalLine(nodes) {
43
+ const value = toString(nodes).trim();
44
+ return (value === '---' || value === '\u2014');
45
+ }
46
+
42
47
  function getHeadingDepth(node) {
43
48
  const { styleId, styleName } = node;
44
49
  if (styleId in HEADING_MAP) {
@@ -265,8 +270,8 @@ export default function paragraph(h, node, parent, siblings) {
265
270
  }
266
271
 
267
272
  if (depth) {
268
- // check if no --- in heading
269
- if (toString(nodes).trim() === '---') {
273
+ // check if no horizontal line in heading
274
+ if (isHorizontalLine(nodes)) {
270
275
  return h('thematicBreak');
271
276
  }
272
277
  const heading = h('heading', { depth }, nodes);
@@ -310,10 +315,10 @@ export default function paragraph(h, node, parent, siblings) {
310
315
  // check for thematicBreaks and frontmatter. they need to be block elements
311
316
  const ret = [];
312
317
  let prevBreak;
313
- let idx = nodes.findIndex((n) => toString(n).trim() === '---');
318
+ let idx = nodes.findIndex(isHorizontalLine);
314
319
  while (idx >= 0) {
315
320
  const brk = h('thematicBreak');
316
- // remove the nodes up until the '---'
321
+ // remove the nodes up until the horizontal line
317
322
  const removed = nodes.splice(0, idx);
318
323
  // if last element is a break, ignore it.
319
324
  if (removed.length && removed[removed.length - 1].type === 'break') {
@@ -321,7 +326,7 @@ export default function paragraph(h, node, parent, siblings) {
321
326
  removed.pop();
322
327
  }
323
328
 
324
- // remove '---'
329
+ // remove the horizontal line
325
330
  nodes.splice(0, 1);
326
331
 
327
332
  // also check if element following is a break
@@ -346,7 +351,7 @@ export default function paragraph(h, node, parent, siblings) {
346
351
  ret.push(brk);
347
352
  prevBreak = brk;
348
353
  }
349
- idx = nodes.findIndex((n) => n.type === 'text' && n.value === '---');
354
+ idx = nodes.findIndex(isHorizontalLine);
350
355
  }
351
356
 
352
357
  // handle remaining nodes