TypeCellOS / TypeCellOS/BlockNote

DOCX Export: list items of different list types are not part of the same numbering instance

Open
#2,227 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug:P4
Dominant language
TypeScript
Stars
10.2k
Forks
772
Avg merge
3d 11h
Merged PRs (30d)
17

Description

Very related to #2225 and #2226

Exported material

bn-lists.docx

BlockNoteLibreOfficeGoogle Docs
Lists that are exported Image Image

Unconventionalness

For the same reason as described in #2225, the numId differs between different list type (ordered/unordered), even when it is a subitem under the same list.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document ...>
  <w:body>
    <!-- ... -->
    <w:p>
      <w:pPr>
        <w:pStyle w:val="ListParagraph"/>
        <w:numPr>
          <w:ilvl w:val="0"/>
          <w:numId w:val="3"/>
        </w:numPr>
      </w:pPr>
      <w:r>
        <w:t xml:space="preserve">List 3 item 3 (unordered)</w:t>
      </w:r>
    </w:p>
    <w:p>
      <w:pPr>
        <w:pStyle w:val="ListParagraph"/>
        <w:numPr>
          <w:ilvl w:val="1"/>
          <w:numId w:val="2"/>
        </w:numPr>
      </w:pPr>
      <w:r>
        <w:t xml:space="preserve">List 3 item 3 subitem 1 (ordered)</w:t>
      </w:r>
    </w:p>
    <w:p>
      <w:pPr>
        <w:pStyle w:val="ListParagraph"/>
        <w:numPr>
          <w:ilvl w:val="1"/>
          <w:numId w:val="2"/>
        </w:numPr>
      </w:pPr>
      <w:r>
        <w:t xml:space="preserve">List 3 item 3 subitem 2 (ordered)</w:t>
      </w:r>
    </w:p>
    <!--- ... -->
  </w:body>
</w:document>

This is unwanted behavior. This explicitly defines the subitems to be a different numbering instance than it's 'parent'.

Conventional method

Define in word/numberings.xml if level 2 needs to be a ordered/numeric or unorderd/bullet. Give every list a different numId as described in #2225 (you can reuse the abstract numberings). This method is compatible with ECMA-376 and with all major editors. To do this properly, word/numberings.xml must be calculated, not be a fixed and static file injected.

Example

(from Google Docs)

word-numbering.xml
word-document.xml
gd.docx

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the exported bn-lists.docx and the provided word/numbering.xml and word/document.xml examples, focusing on how list levels and numId values are represented. Confirm that a mixed ordered/unordered sublist remains in the parent numbering instance while preserving its level-specific formatting. Done means the generated DOCX matches the conventional behavior in major editors; no source file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
content, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.