@adobe/helix-docx2md 1.5.11 → 1.5.12

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.5.12](https://github.com/adobe/helix-docx2md/compare/v1.5.11...v1.5.12) (2024-04-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * restart mumbering on sublists ([#443](https://github.com/adobe/helix-docx2md/issues/443)) ([21d522f](https://github.com/adobe/helix-docx2md/commit/21d522f2c97c9993ca393aee606306e67c70170a))
7
+
1
8
  ## [1.5.11](https://github.com/adobe/helix-docx2md/compare/v1.5.10...v1.5.11) (2024-04-20)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-docx2md",
3
- "version": "1.5.11",
3
+ "version": "1.5.12",
4
4
  "description": "Helix library that converts word documents to markdown",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -236,18 +236,17 @@ export default function paragraph(h, node, parent, siblings) {
236
236
  let numInfo = h.numbering[numId];
237
237
  if (!numInfo) {
238
238
  numInfo = {
239
- levels: { },
239
+ levels: [],
240
240
  };
241
241
  // eslint-disable-next-line no-param-reassign
242
242
  h.numbering[numId] = numInfo;
243
243
  }
244
- let lvlInfo = numInfo.levels[level];
245
- if (!lvlInfo) {
246
- lvlInfo = {
247
- num: 1,
248
- };
249
- numInfo.levels[level] = lvlInfo;
244
+ while (numInfo.levels.length <= lvl) {
245
+ numInfo.levels.push({ num: 1 });
250
246
  }
247
+ // clear levels after current, as sub-lists always restart the numbering
248
+ numInfo.levels.splice(lvl + 1);
249
+ const lvlInfo = numInfo.levels[lvl];
251
250
  listItem.bullet = `${lvlInfo.num}.`;
252
251
  lvlInfo.num += 1;
253
252
  }