Skip to content

fix(parser): accept longer closing fences during table extraction - #20028

Merged
JinHai-CN merged 1 commit into
infiniflow:mainfrom
imexlovery:codex/markdown-long-closing-fence
Sep 24, 2026
Merged

JinHai-CN merged 1 commit into
infiniflow:mainfrom
imexlovery:codex/markdown-long-closing-fence

Conversation

@imexlovery

Copy link
Copy Markdown
Contributor

Summary

Accept closing code fences that use the same character and are longer than the opening fence. Previously, table extraction treated the remaining document as code and skipped real tables.

Validation

  • Added four cases: backticks and tildes, with Markdown and HTML tables. All fail before the fix.
  • All 20 Markdown parser tests pass locally.
  • Ruff formatting and git diff --check pass. Existing lint findings remain unchanged; no new findings.
  • No live ingestion or retrieval run.

This follows the CommonMark closing-fence rule: https://spec.commonmark.org/0.31.2/#fenced-code-blocks
No public issue has been filed. Investigation, code, and tests used AI assistance.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 04cff825-0e3f-4caa-aeec-158cbccacafe

📥 Commits

Reviewing files that changed from the base of the PR and between d1aa4e6 and 45cc02e.

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

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The Markdown parser now requires matching fence marker types and supports longer closing fences. Parameterized tests cover backtick and tilde fences followed by pipe or HTML tables.

Changes

Markdown fence matching

Layer / File(s) Summary
Fence matching and regression coverage
deepdoc/parser/markdown_parser.py, test/unit_test/deepdoc/parser/test_markdown_parser.py
The parser matches backtick fences with backtick closers and tilde fences with tilde closers. Tests verify table extraction and fenced-content preservation.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: wangq8

Merge Risk: ⚪ Minimal · up to 45cc0

The parser now correctly preserves fenced content and extracts subsequent Markdown or HTML tables; no actionable merge-blocking risk remains.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. 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 describes the main change: accepting longer closing fences during table extraction. It is concise and specific.
Description check ✅ Passed The description includes the required Summary section and explains the problem, solution, test coverage, and validation results. The additional sections provide useful context.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

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

A rabbit checks each fence with care
Backticks meet backticks in the air
Tildes close where tildes start
Tables leave the block intact
Clean markdown hops along
The parser sings a tidy song

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

@xugangqiang xugangqiang added the ci Continue Integration label Sep 23, 2026
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.07%. Comparing base (c18f0dd) to head (45cc02e).
⚠️ Report is 58 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #20028   +/-   ##
=======================================
  Coverage   38.07%   38.07%           
=======================================
  Files          54       54           
  Lines       15500    15500           
  Branches      125      125           
=======================================
  Hits         5902     5902           
  Misses       9570     9570           
  Partials       28       28           

☔ 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.

@xugangqiang

Copy link
Copy Markdown
Contributor

LGTM

@JinHai-CN
JinHai-CN merged commit f4014e6 into infiniflow:main Sep 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants