Skip to content

docs: say a table goes next to paragraphs, never in a paragraph's children - #3859

Merged
dolanmiu merged 1 commit into
masterfrom
docs/table-not-in-paragraph
Oct 28, 2026
Merged

dolanmiu merged 1 commit into
masterfrom
docs/table-not-in-paragraph

Conversation

@dolanmiu

@dolanmiu dolanmiu commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Closes #2711

Problem

#2711's attached code converts a rich text editor's HTML to docx, and puts each table in a paragraph:

paragraphs.push(new Paragraph({ children: [table] }));

That writes a w:tbl inside a w:p, which Word can't open. The Open XML SDK validator reports it as The element has invalid child element 'w:tbl' at /w:body/w:p[2].

Since 9.13.0 (#3790, for #2395) TypeScript rejects that line. Type-checking the attached code gives Type 'Table' is not assignable to type 'ParagraphChild' with 9.15.0, and nothing with 9.12.0. Plain JavaScript still writes the broken file, though, and the docs never said where a table can go: tables.md only says to add it to the section.

Change

tables.md's intro now says a table goes next to paragraphs, in a section's, header's, footer's, cell's or text box's children, never in a paragraph's, and gives the TypeScript error.

The fix for the converter is to return (Paragraph | Table)[] and push the table itself. With the table in the section's children, the same document passes the validator.

Not in this PR

There's no runtime check in Paragraph, as #3790 also left out.

Summary by CodeRabbit

  • Documentation
    • Clarified where tables can be placed in a document and noted that placing one inside a paragraph may prevent Word from opening the document and trigger a TypeScript error.

…ldren

#2711's HTML converter put each table in `new Paragraph({ children: [table] })`,
which writes a w:tbl inside a w:p that Word can't open. TypeScript has
rejected it since 9.13.0 (#3790), but plain JavaScript still writes it,
and the docs never said where a table can go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X5zGDL3sgGVBMXPfny376c
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d662a0a-b071-4b72-96da-41541a7878c3
Commits

Reviewing files that changed from the base of the PR and between 027c288 and 182be09.

Files selected for processing: 1
  • docs/usage/tables.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The tables guide now states where to place tables and describes the reported consequences of placing a table inside a paragraph.

Changes: Table placement guidance

Layer / File(s) Summary
Table placement constraints
docs/usage/tables.md
The intro directs readers to place tables in container children, not paragraph children. It also notes Word’s document-opening limitation and a TypeScript error reported since version 9.13.0.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other · Severity of issue fixed: Low

Merge Risk: Minimal · up to 182be

The documentation clarifies where tables belong without changing runtime behavior. No merge-blocking issue was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Linked Issues check Warning Issue #2711 reports a document-opening failure caused by placing a table inside paragraph children. The reviewed change updates only docs/usage/tables.md, as shown by the commit history and supplied… Implement the converter change described in the PR. Add an automated regression test that verifies a generated document places the table as a section child and passes the relevant document validation.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main documentation change: tables must be placed next to paragraphs, not inside paragraph children.
Out of Scope Changes check Passed The changed file documents the valid table placement for sections, headers, footers, cells, and text boxes. This change directly addresses the table-placement problem in issue #2711. No unrelated chan…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Out of Scope Changes check

Explanation

The changed file documents the valid table placement for sections, headers, footers, cells, and text boxes. This change directly addresses the table-placement problem in issue #2711. No unrelated change is shown.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Full details: Linked Issues check

Explanation

Issue #2711 reports a document-opening failure caused by placing a table inside paragraph children. The reviewed change updates only docs/usage/tables.md, as shown by the commit history and supplied change summary. It does not implement the stated converter change to return (Paragraph | Table)[] and place the table directly in section children. No automated regression test proves valid document output.

Resolution

Implement the converter change described in the PR. Add an automated regression test that verifies a generated document places the table as a section child and passes the relevant document validation.

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (027c288) to head (182be09).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3859   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          576       576           
  Lines        27809     27809           
  Branches     10186     10186           
=========================================
  Hits         27809     27809           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dolanmiu
dolanmiu merged commit a75d7a3 into master Oct 28, 2026
18 checks passed
@dolanmiu
dolanmiu deleted the docs/table-not-in-paragraph branch October 28, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant