Skip to content

docx writer always synthesizes numId 1 / bullet regardless of ContentListMembership's own numId/numFmt #1273

Description

@Mearman

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions