Repository navigation
refactor(parser): preserve HTML <table> structure (inline + structured item) - #18101
Closed
xugangqiang wants to merge 2 commits into
Closed
xugangqiang wants to merge 2 commits into
xugangqiang wants to merge 2 commits into
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
xugangqiang
force-pushed
the
fix/html-table-structure
branch
from
August 11, 2026 08:48
ec7303d to
498dbb6
Compare
xugangqiang
force-pushed
the
fix/parser-align-foundation
branch
from
August 11, 2026 09:17
f2e724d to
1e39d24
Compare
…d item) Stop flattening <table> into a single text blob. A <table> now emits: 1. an inlined doc_type_kwd:"text" item keeping the <table>...</table> markup (row/column structure survives for embedding/retrieval/LLM rendering), and 2. a structured doc_type_kwd:"table" / ck_type:"table" item appended after the walk, consumed by the downstream chunker. Covers both top-level tables (walkHTMLBlocks) and tables nested in div/section/article (via walkHTMLLeaf). Mirrors markdown_parser.go table handling and Python's RAGFlowHtmlParser. Tests: - TestHTMLParser_TableProducesStructuredItems - TestHTMLParser_NestedTableProducesStructuredItems - TestHTMLParser_NestedListItemsPreserved - TestHTMLParser_PrePreservesVerbatim - TestHTMLParser_AlignmentGolden (compares vs html.python.golden.json, ignores "table" via meta.accepted_divergences) Depends on #18014 and the foundation helpers PR (align_test.go). Files: internal/parser/parser/html_parser.go internal/parser/parser/html_parser_align_test.go (new) internal/parser/parser/testdata/html.python.golden.json (new) internal/parser/parser/testdata/html.sample.html (new)
xugangqiang
force-pushed
the
fix/html-table-structure
branch
from
August 11, 2026 09:21
498dbb6 to
b3f9bed
Compare
renderTableHTML only fails on unsupported node kinds, which a parsed <table> never triggers, so the degenerate flatten-children branch in walkHTMLLeaf is unreachable. Remove it so the nested-table path matches the top-level walkHTMLBlocks case (both skip silently when the markup is empty). Also tighten the inaccurate 'mirrors Python's HtmlParser' inline comment in the same block (the two-item split is the markdown_parser.go model; Python keeps the table once, outside the inline flow).
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
Stop flattening
<table>into a single text blob. A<table>now emits:doc_type_kwd:"text"item keeping the<table>…</table>markup(row/column structure survives for embedding/retrieval/LLM rendering), and
doc_type_kwd:"table"/ck_type:"table"item appended afterthe walk, consumed by the downstream chunker.
Covers both top-level tables (
walkHTMLBlocks) and tables nested indiv/section/article (via
walkHTMLLeaf). Mirrorsmarkdown_parser.go'stwo-item table handling (inline
textcopy + appendeddoc_type_kwd:"table"item). It matches Python's
RAGFlowHtmlParseronly in keeping the raw<table>…</table>markup: Python keeps the table once, outside the inlineflow, and adds
doc_type_kwd/ck_typedownstream — this change emits bothitems at the parser layer.
Test plan
TestHTMLParser_TableProducesStructuredItemsTestHTMLParser_NestedTableProducesStructuredItemsTestHTMLParser_NestedListItemsPreservedTestHTMLParser_PrePreservesVerbatimTestHTMLParser_AlignmentGolden(compares vshtml.python.golden.json,ignores
"table"viameta.accepted_divergences)Dependency
Stacks on #18014 (framework in
main) and the foundation helpers PR(
fix/parser-align-foundation).Note
This change was not described in the original combined PR's title; called out
here for explicit review.
Related