Skip to content

fix(parse): keep Markdown that is not YAML frontmatter - #7746

Open
123XieC wants to merge 1 commit into
volcengine:mainfrom
123XieC:fix/markdown-preserve-non-frontmatter
Open

123XieC wants to merge 1 commit into
volcengine:mainfrom
123XieC:fix/markdown-preserve-non-frontmatter

Conversation

@123XieC

@123XieC 123XieC commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Description

With extract_frontmatter=True, a Markdown file that opens with a horizontal rule can lose its first section. Previously, the parser stripped the delimited block before checking whether it decoded to a mapping. Preserve the original Markdown when decoding fails or returns a non-mapping. Valid YAML mappings are still extracted.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Fixes #7745

Type of Change

  • Bug fix

Changes Made

  • Only remove a matched block when it yields YAML frontmatter metadata.
  • Extend the existing extraction test to assert what the actual Markdown import writes to the local artifact store.

Testing

The ruler and bold-text cases failed on the base revision and pass with this change. All 91 Markdown parser tests passed on macOS; Ruff lint and formatting checks passed. Scoped mypy reported the same four pre-existing diagnostics on the base and modified source, with no new diagnostics.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug]: Markdown frontmatter extraction can strip ordinary Markdown

1 participant