Repository navigation
fix(parser): preserve loose body text in HTMLParser - #17290
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe HTML parser now preserves eligible loose text, skips head metadata, centralizes text-item creation, and excludes noscript content alongside script and style subtrees. Tests cover wrapper text, omitted body elements, head text, and hidden content. ChangesHTML parser behavior
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
Summary
Closes #17278.
The Go HTMLParser now preserves non-empty loose text that appears directly under the parsed body, including preamble, between-block, and trailing text, instead of dropping it while walking block elements.
It continues to skip head metadata and script/style/noscript content, including nested script/style/noscript subtrees.
Tests:
bash build.sh --test -run 'TestHTMLParser_ParseWithResult|TestWalkHTMLBlocks' ./internal/parser/parserbash build.sh --test ./internal/parser/parsergit diff --check -- internal/parser/parser/html_parser.go internal/parser/parser/parse_with_result_test.go