Files
ragflow/internal/parser
xugangqiang b3f9bed8a0 refactor(parser): preserve HTML <table> structure (inline + structured 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)
2026-08-11 17:21:21 +08:00
..