Skip to content

Allow editors to add or remove subsection headings - #778

Draft
mikec-ai wants to merge 2 commits into
mainfrom
codex/issue-773-heading-toggle
Draft

Allow editors to add or remove subsection headings#778
mikec-ai wants to merge 2 commits into
mainfrom
codex/issue-773-heading-toggle

Conversation

@mikec-ai

@mikec-ai mikec-ai commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Closes #773.

What changed

  • Allows editors to add a heading to a headingless subsection.
  • Allows editors to remove a heading while preserving the subsection content and existing anchor.
  • Keeps subsection name and heading level together behind one heading-presence control.
  • Makes added and removed headings visible in Compare.
  • Preserves valid navigation targets in HTML and Word exports.
  • Confirms that re-import remains source-authoritative for heading structure.

Design alignment

  • Reuses the existing tiled checkbox pattern already used for callout and page-break controls.
  • Reuses the existing subsection-name input and heading-level select.
  • Keeps the merged callout component from Allow editors to add or remove subsection callout styling #775 unchanged.
  • Adds no new CSS or standalone UI component.
  • Uses only a small interaction in the existing subsection edit script to show or hide the existing heading fields.

The control order is:

  1. Include a subsection heading
  2. Subsection name and heading level, when applicable
  3. Is callout box?
  4. Add a page break

Why

Builder already allows editors to rename headings and change their levels, but the edit page prevented the existing form and data model from representing headed-to-headingless and headingless-to-headed transitions. Editors could not directly correct missing or unnecessary subsection headings without changing the source document and re-importing.

Validation

  • Verified add-heading and remove-heading interactions in the rendered Builder UI.
  • Verified existing callout and page-break controls remain unchanged.
  • Covered heading state, validation, anchors, table-of-contents membership, first-subsection rendering, appendix tables, Compare, Word export, and re-import.
  • 83 focused tests passed.
  • Full test suite: 1,600 tests passed.

Heading Removed Selection
image

Heading Added Selection
image

@mikec-ai
mikec-ai marked this pull request as draft July 28, 2026 21:16
@mikec-ai

Copy link
Copy Markdown
Collaborator Author

Moving this PR back to draft after an additional adversarial review identified three interactions that need to be resolved before merge:

  • Removing the heading from a recognized portrait callout such as Key facts or Key dates can also change its placement from the margin to the main document flow, because placement is currently inferred from the subsection name.
  • Compare detects heading-presence changes internally but does not yet render the old and new heading states correctly in its user-facing columns.
  • Combined adjacent heading changes can be classified as additions and deletions instead of updates, even when their anchors remain stable.

main and production are unaffected because this PR has not merged. The branch and its test coverage are being retained while we narrow the scope and address these dependencies. We will return the PR to ready for review only after the rendered Compare behavior, callout placement behavior, and matching expectations are explicitly resolved and re-reviewed.

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.

Allow editors to add or remove a subsection heading

2 participants