feat: extract Markdown frontmatter metadata#11615
Open
gyx09212214-prog wants to merge 1 commit into
Open
Conversation
|
@gyx09212214-prog is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
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
Adds optional YAML frontmatter extraction to
MarkdownToDocument.When
extract_frontmatter=True, Markdown files beginning with--- ... ---are parsed with PyYAML. Mapping values are added toDocument.metaand the frontmatter block is removed before rendering document content. The default remains unchanged, so existing users keep frontmatter in the converted content unless they opt in.Metadata precedence is
ByteStream.meta< frontmatter <run(meta=...), matching the existing behavior where explicit runtime metadata can override source metadata. Date-like YAML scalars are kept as strings so common note fields likedate: 2026-06-12remain JSON-serializable metadata.This is useful for Markdown/RAG ingestion pipelines where source notes carry fields like ticker, source, report date, author, or document id in frontmatter and downstream retrievers need them as metadata filters or citations.
Tests
python -m pytest test/components/converters/test_markdown_to_document.py -qpython -m py_compile haystack\components\converters\markdown.py test\components\converters\test_markdown_to_document.pypython -m ruff check haystack\components\converters\markdown.py test\components\converters\test_markdown_to_document.pygit diff --check