Skip to content

docs(document-cli): correct stale outline heading-nesting claim for docx/odt - #1006

Merged
Mearman merged 4 commits into
mainfrom
fix/heading-level-stamped-on-docx-odt-write
Sep 5, 2026
Merged

docs(document-cli): correct stale outline heading-nesting claim for docx/odt#1006
Mearman merged 4 commits into
mainfrom
fix/heading-level-stamped-on-docx-odt-write

Conversation

@Mearman

@Mearman Mearman commented Sep 5, 2026

Copy link
Copy Markdown
Member

Fixes #961

Investigated whether the outline command still loses heading nesting for a docx/odt this ecosystem's own writers produce, per the README claim the issue quotes as its evidence. It doesn't reproduce: buildDocxPackage (documents.js's edit/docx writer) has stamped w:outlineLvl since c16d5f4, and buildOdtPackage/odf.js's writeOdt have promoted a heading paragraph to a real text:h with text:outline-level since the #752/#780 fixes -- both predate this issue by roughly two weeks. document-outline.js's buildOutline reads that signal correctly on both formats.

Verified four ways: a docx and an odt built directly through documents.js's own editor API (createDocx/createOdt, setting headingLevel on a paragraph) both nest correctly through document-cli outline, and so does a markdown source converted through the real convert command to docx and to odt. Every path preserves "Top Heading > Body / Sub Heading > Body" nesting exactly.

The issue's own evidence was the document-cli README's outline-command description, written 2026-08-19 when the gap was real, never updated once the docx (2026-08-21) and odt fixes landed. This PR corrects that stale claim and pins the now-correct behaviour with two new regression tests (docx and odt, each built through the ecosystem's own editor rather than authored by Word/LibreOffice) so a future regression in either writer's heading-signal stamping fails here.

No writer/reader code changed -- both ooxml.js's and documents.js's own docx write paths, and both odf.js's and documents.js's own odt write paths, already stamp the signal correctly.

@Mearman
Mearman marked this pull request as ready for review September 5, 2026 14:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-05T14:03:39.949656Z 98529df Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…editor-built documents

buildOutline reads a paragraph's headingLevel off the group anchor a
DocumentTree carries, and that signal round-trips correctly today for
both formats: buildDocxPackage stamps w:outlineLvl and buildOdtPackage
promotes a heading paragraph to a real text:h with text:outline-level.
Pins the outline command's own nesting behaviour against a docx/odt
built through this ecosystem's editor rather than authored by Word or
LibreOffice, so a future regression in either writer's heading-signal
stamping fails here rather than only in a real-world source document.
…ing-nesting claim

buildDocxPackage started stamping w:outlineLvl and buildOdtPackage
started promoting a heading paragraph to a real text:h shortly after
this claim was written, but the outline command's own docs were never
updated to match. Heading nesting through outline works for a docx/odt
this ecosystem's own writers produce, not only for one authored by
Word or LibreOffice.
…to the real setters

The docx and odt heading-nesting test comments credited buildDocxPackage/buildOdtPackage
with stamping w:outlineLvl and promoting a paragraph to text:h, but neither test exercises
those functions -- both drive the editor's own createDocx()/createOdt() through
DocxParagraph.headingLevel and OdtParagraph.headingLevel, which buildDocxPackage and
buildOdtPackage each delegate to for the identical write. writeOdt itself, named in the odt
comment, is never called by this ecosystem at all. The docx comment also narrated the bug
report's own history (issue #961 already fixed by the time it was filed) rather than stating
the invariant the test actually pins.
…ically

createOdt sat ahead of createOds in the named-import list.
@Mearman
Mearman force-pushed the fix/heading-level-stamped-on-docx-odt-write branch from 98529df to 0ccab7a Compare September 5, 2026 17:01
@Mearman
Mearman enabled auto-merge (rebase) September 5, 2026 17:02
@Mearman
Mearman merged commit 34a8975 into main Sep 5, 2026
18 checks passed
@Mearman
Mearman deleted the fix/heading-level-stamped-on-docx-odt-write branch September 5, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

document-cli's outline command loses heading nesting for docx and odt this ecosystem itself produces

1 participant