Skip to content

fix(core): close summary elements with empty content - #2589

Open
pradeep-ramola wants to merge 1 commit into
actions:mainfrom
pradeep-ramola:fix/1567-empty-summary-elements
Open

pradeep-ramola wants to merge 1 commit into
actions:mainfrom
pradeep-ramola:fix/1567-empty-summary-elements

Conversation

@pradeep-ramola

Copy link
Copy Markdown

Summary

Fixes #1567.

Distinguish empty string content from the null sentinel used for void HTML elements in the shared summary wrapper.

Previously summary.addList([]) emitted an unclosed <ul>, and the same truthiness check also omitted closing tags for empty headings, links, quotes, table cells, and other summary elements. An empty link or code block could therefore capture subsequent summary content.

Check content === null instead of !content. Empty strings now produce paired tags, while img, br, and hr retain their existing void-tag output. For empty lists, this uses the issue's suggested <ul></ul> / <ol></ol> alternative rather than making the operation a no-op.

Regression coverage

Add 11 cases covering empty ordered/unordered lists, list items, tables, rows, cells, code blocks, headings, quotes, links, and details labels. Each checks the buffer, following content, written summary file, chainability, and buffer clearing after a write. All 11 cases fail before the production change.

The existing nonempty-content and void-element tests remain unchanged and pass.

Validation

  • npm test -- --runInBand --runTestsByPath packages/core/__tests__/summary.test.ts (39 passing)
  • npm test -- --maxWorkers=2 packages/core/__tests__ (5 suites, 154 tests passed; exit status 0)
  • npm run tsc --prefix packages/core (with local dependencies built first)
  • npx eslint packages/core/src/summary.ts packages/core/__tests__/summary.test.ts
  • npx prettier --check packages/core/src/summary.ts packages/core/__tests__/summary.test.ts
  • git diff --check

Validated locally on Windows. No live GitHub Actions rendering smoke test was performed. No public API or dependency changes. AI assistance was used to develop and validate this change.

@pradeep-ramola
pradeep-ramola requested a review from a team as a code owner November 23, 2026 01:02

This branch has not been deployed

No deployments
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.

Using core.summary.addList([]) should be a no-op, instead it's broken HTML

1 participant