Markdown Frontmatter Plugin¶
The markdown_frontmatter plugin provides a tool to extract and parse metadata from Markdown files. It uses python-frontmatter to cleanly separate frontmatter blocks (YAML, TOML, or JSON) from the document body, and returns the parsed metadata in a user-specified format.
Tools¶
get_markdown_frontmatter¶
Extracts and parses frontmatter from a Markdown file.
Arguments:
file_path(string, required): Path to the Markdown file.output_format(string, optional): The format in which to return the metadata. Allowed values are"json","yaml","toml", or"dict". Defaults to"json".
Features:
- Automatic Format Detection: Seamlessly handles YAML (
---), TOML (+++), and JSON frontmatter. .aiignoreCompliance: If the target file is ignored by.aiignorerules, the tool will refuse to process it, returning an error.- Size Limits: Ensures files do not exceed a safe processing size (defaults to 1MB).
- Flexible Output: Allows the caller to consume the metadata in the most convenient format.
Example¶
Assuming you have a file post.md with the following content:
When you invoke the tool:
The tool will return: