Retain numbering id in list paragraphs
See original GitHub issueAssume you have a document with 2 level 0 ordered lists:
1. one
2. two
Something else
3. three
Something else
1. one
2. two
the numbering information provided in the AST node does not contain the information about the numbering, so itβs not possible to continue the first list after the non-list paragraph.
document[8]
ββ0 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0"}
β ββ0 run[1]
β ββ0 text "One"
ββ1 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0"}
β ββ0 run[1]
β ββ0 text "Two"
ββ2 paragraph[1]
β β styleId: "Normal"
β ββ0 run[1]
β ββ0 text "Something else"
ββ3 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0"}
β ββ0 run[1]
β ββ0 text "Three"
ββ4 paragraph[1]
β ββ0 run[1]
β ββ0 text "Something else"
ββ5 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0"}
β ββ0 run[1]
β ββ0 text "One"
ββ6 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0"}
β ββ0 run[1]
β ββ0 text " Two"
ββ7 paragraph[0]
If the numId
would be added to the numbering
information, it would be possible to detect the continuation.
document[8]
ββ0 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0","numId":"1"}
β ββ0 run[1]
β ββ0 text "One"
ββ1 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0","numId":"1"}
β ββ0 run[1]
β ββ0 text "Two"
ββ2 paragraph[1]
β β styleId: "Normal"
β ββ0 run[1]
β ββ0 text "Something else"
ββ3 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0","numId":"1"}
β ββ0 run[1]
β ββ0 text "Three"
ββ4 paragraph[1]
β ββ0 run[1]
β ββ0 text "Something else"
ββ5 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0","numId":"4"} <<========
β ββ0 run[1]
β ββ0 text "One"
ββ6 paragraph[1]
β β styleId: "ListParagraph"
β β numbering: {"isOrdered":true,"level":"0","numId":"4"}
β ββ0 run[1]
β ββ0 text " Two"
ββ7 paragraph[0]
diff --git a/lib/docx/numbering-xml.js b/lib/docx/numbering-xml.js
index 64c4210..a68fbf4 100644
--- a/lib/docx/numbering-xml.js
+++ b/lib/docx/numbering-xml.js
@@ -15,13 +15,16 @@ function Numbering(nums, abstractNums, styles) {
}),
"paragraphStyleId"
);
function findLevel(numId, level) {
var num = nums[numId];
if (num) {
var abstractNum = abstractNums[num.abstractNumId];
if (abstractNum.numStyleLink == null) {
- return abstractNums[num.abstractNumId].levels[level];
+ var lvl = abstractNums[num.abstractNumId].levels[level];
+ return Object.assign({numId: numId}, lvl);
} else {
var style = styles.findNumberingStyleById(abstractNum.numStyleLink);
return findLevel(style.numId, level);
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Restart Numbering Issue with Paragraphs with Locked ...
I have found an issue where Word is losing its numbering in Paragraphs that have Locked Content Controls after updating styles in a...
Read more >Create bulleted and numbered lists in InDesign
Click the Bulleted List button or the Numbered List button in the Control panel (in Paragraph mode). Hold down Alt (Windows) or Option...
Read more >Getting Automatic Paragraph Numbering Back on Track
Fixing it is simple: Just right-click on one of the numbers and choose Adjust List Indents. Depending on whether you're using single-level or...
Read more >InDesign Numbered List - How to create and use it best
Change the numbering style. Keep your selection on the numbered list. At the far left of the control bar at the top, inside...
Read more >Setting up Numbered Lists that Jump Frames in CS3
On page 1 of your ID doc, hold down the Shift key when you Place that text file into the small text frame....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have a fork: https://github.com/adobe-rnd/mammoth.js/tree/bleeding that uses my suggestion above: https://github.com/adobe-rnd/mammoth.js/commit/60a679eb0c0599c7b0f5d2ca83fbb1c55b84c73e
itβs released as: https://www.npmjs.com/package/@adobe/mammoth/v/1.4.15-bleeding.1
sorry @hmnd , I was preoccupied with other thingsβ¦ Iβll take a look at it now.