Repository navigation
fix(core): close summary elements with empty content - #2589
Open
pradeep-ramola wants to merge 1 commit into
Open
pradeep-ramola wants to merge 1 commit into
pradeep-ramola wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1567.
Distinguish empty string content from the
nullsentinel 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 === nullinstead of!content. Empty strings now produce paired tags, whileimg,br, andhrretain 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.tsnpx prettier --check packages/core/src/summary.ts packages/core/__tests__/summary.test.tsgit diff --checkValidated 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.