buildDocumentBytes's docx writer always emits numId "1" as a bullet list for any paragraph carrying a ContentListMembership, ignoring the membership's own numId and numFmt fields entirely.
Repro (from documents.js itself, packages/web workspace):
import { assembleTree } from "document-schema.js";
import { buildDocumentBytes, documentTreeWithSchema, decodeDocumentPackage, readDocxExtras } from "documents.js";
const bytes = buildDocumentBytes(documentTreeWithSchema(assembleTree({
kind: "wordprocessing", metadata: {},
sections: [{ pageSize: { widthPt: 595, heightPt: 842 }, margins: { topPt:0,rightPt:0,bottomPt:0,leftPt:0 },
blocks: [
{ kind: "paragraph", runs: [{ text: "ordered item" }], list: { numId: "2", level: 0, format: "decimal" } },
] }],
})), "docx");
console.log(readDocxExtras(decodeDocumentPackage("docx", bytes)).numbering);
// { "1": { levels: { "0": { format: "bullet", text: "•", startAt: 1 } } } }
// expected numId "2", format "decimal"
Also reproduces for a paragraph with no list.numId at all (list: { level: 0 }) -- the writer still synthesizes numId "1" as a bullet list rather than leaving the paragraph unlisted, so a round trip through this writer can't currently be used to test a numId-less list membership either.
Found while writing a packages/web mutation test against normalizeDocxListKinds (router.ts), which needed a real docx with a non-bullet/non-default numbering definition to exercise the resolve-by-numId branch -- every fixture I built came back as numId "1"/bullet regardless of what I asked for, in isolation, so it's the writer, not test pollution.
Not blocking anything there -- I fell back to asserting the writer's actual current output (numId "1"/bullet) instead of the specific numId/format requested, which still exercises the real numbering.xml round trip, just not the ordered/no-numId branches.
buildDocumentBytes's docx writer always emits numId "1" as a bullet list for any paragraph carrying a ContentListMembership, ignoring the membership's own
numIdandnumFmtfields entirely.Repro (from
documents.jsitself,packages/webworkspace):Also reproduces for a paragraph with no
list.numIdat all (list: { level: 0 }) -- the writer still synthesizes numId "1" as a bullet list rather than leaving the paragraph unlisted, so a round trip through this writer can't currently be used to test a numId-less list membership either.Found while writing a
packages/webmutation test againstnormalizeDocxListKinds(router.ts), which needed a real docx with a non-bullet/non-default numbering definition to exercise the resolve-by-numId branch -- every fixture I built came back as numId "1"/bullet regardless of what I asked for, in isolation, so it's the writer, not test pollution.Not blocking anything there -- I fell back to asserting the writer's actual current output (numId "1"/bullet) instead of the specific numId/format requested, which still exercises the real numbering.xml round trip, just not the ordered/no-numId branches.