Skip to content

fix(deepdoc): accept GFM table separators with one or more dashes#16319

Merged
wangq8 merged 4 commits into
infiniflow:mainfrom
Harsh23Kashyap:Harsh23Kashyap/fix/markdown-gfm-separator
Jun 25, 2026
Merged

fix(deepdoc): accept GFM table separators with one or more dashes#16319
wangq8 merged 4 commits into
infiniflow:mainfrom
Harsh23Kashyap:Harsh23Kashyap/fix/markdown-gfm-separator

Conversation

@Harsh23Kashyap

Copy link
Copy Markdown
Contributor

Summary

  • Relax _is_table_separator_row regex from {3,} dashes to + so valid GFM separators like :-- and --: are recognized.
  • Add regression test ensuring short-separator pipe tables stay intact during extraction.

Test plan

  • .v/bin/python -m ruff check deepdoc/parser/markdown_parser.py test/unit_test/deepdoc/parser/test_markdown_parser.py
  • .v/bin/python -m pytest test/unit_test/deepdoc/parser/test_markdown_parser.py::TestMarkdownElementExtractorTables::test_custom_delimiter_preserves_gfm_short_separator_table -q

Fixes #16314

Relax _is_table_separator_row to match valid :-- / --: rows so markdown
tables are not fragmented row-by-row.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 24, 2026
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 12f84e39-c316-4615-9387-ee6bc610fbb5

📥 Commits

Reviewing files that changed from the base of the PR and between 66d242e and 1ac6b5b.

📒 Files selected for processing (1)
  • test/unit_test/deepdoc/parser/test_markdown_parser.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/unit_test/deepdoc/parser/test_markdown_parser.py

📝 Walkthrough

Walkthrough

The markdown table-separator regex now accepts one or more hyphens instead of requiring three or more, and a unit test verifies that a short-separator GFM table stays intact during extraction.

Changes

GFM Short Separator Fix

Layer / File(s) Summary
Separator regex and table extraction test
deepdoc/parser/markdown_parser.py, test/unit_test/deepdoc/parser/test_markdown_parser.py
The table-separator matcher changes from ^:?-{3,}:?$ to ^:?-+:?$, and a new unit test checks that extract_elements(delimiter="\n") preserves a short-separator pipe table as one section between surrounding text.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

🐞 bug, ci, size:S, 🌈 python

Suggested reviewers

  • wangq8

Poem

A rabbit found tables with dashes so few,
Yet parser and tests now both know what to do.
One hyphen is enough, the rows line up right,
And the table hops through in a single chunk bright. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: relaxing GFM table separator handling in deepdoc markdown parsing.
Description check ✅ Passed The description covers the problem, the fix, and testing, though it does not follow the template's exact headings or include type of change.
Linked Issues check ✅ Passed The regex update and regression test directly address issue #16314 by accepting valid short GFM table separators.
Out of Scope Changes check ✅ Passed The PR stays focused on markdown separator parsing and a related regression test, with no unrelated code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Harsh23Kashyap

Copy link
Copy Markdown
Contributor Author

Could a maintainer add the ci label so full workflows run on this PR?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/unit_test/deepdoc/parser/test_markdown_parser.py`:
- Around line 156-166: The new test in
test_custom_delimiter_preserves_gfm_short_separator_table is missing the
required pytest priority marker. Add the appropriate p1/p2/p3 marker to this
test, following the existing test suite conventions for test_markdown_parser and
other tests in test_*.py, so the new case is categorized consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13e4a568-4f14-43b5-839a-67529656b6be

📥 Commits

Reviewing files that changed from the base of the PR and between c2665d4 and 66d242e.

📒 Files selected for processing (2)
  • deepdoc/parser/markdown_parser.py
  • test/unit_test/deepdoc/parser/test_markdown_parser.py

Comment thread test/unit_test/deepdoc/parser/test_markdown_parser.py
@yingfeng yingfeng requested a review from KevinHuSh June 24, 2026 16:11
@yingfeng yingfeng added the ci Continue Integration label Jun 24, 2026
@yingfeng yingfeng marked this pull request as draft June 24, 2026 16:11
@yingfeng yingfeng marked this pull request as ready for review June 24, 2026 16:11
@dosubot dosubot Bot added 🐞 bug Something isn't working, pull request that fix bug. 🧪 test Pull requests that update test cases. labels Jun 24, 2026
@wangq8 wangq8 added ci Continue Integration and removed ci Continue Integration labels Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (1dfc240) to head (735c065).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16319   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wangq8 wangq8 merged commit 66d8615 into infiniflow:main Jun 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files. 🧪 test Pull requests that update test cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Markdown parser rejects valid GFM table separator rows with fewer than 3 dashes

3 participants