--- id: mdformat-frontmatter version: "2.1.2" license: MIT license_treatment: permissive maintenance: active --- # mdformat-frontmatter — An mdformat plugin for parsing / ignoring frontmatter. License: permissive · Maintenance: active · Downloads: 1.2M/mo ## What it is and what it does mdformat-frontmatter extends the mdformat markdown formatter to recognize and preserve YAML front matter blocks—the metadata headers used by static site generators like Jekyll. When mdformat processes a markdown file, this plugin ensures that properly formed YAML blocks at the beginning of the file are left intact rather than being reformatted or stripped. The plugin works by integrating with mdformat's plugin system and depends on ruamel-yaml for YAML parsing and mdit-py-plugins for markdown-it integration. The plugin is straightforward in scope: it validates that YAML front matter appears only at the file's start (first one or two lines) and allows well-formed blocks to pass through unchanged. The maintainers note that the plugin is not sophisticated about handling malformed YAML—incorrectly structured blocks may produce unexpected behavior—so it works best when front matter is already valid. Use it for: - Format markdown files for Jekyll or other static site generators that rely on YAML front matter for configuration and metadata. - Integrate mdformat into a documentation build pipeline without losing front matter headers during formatting passes. - Ensure consistent markdown style across a project while preserving metadata used by automation tools. - Enforce markdown formatting standards in a monorepo where some files use YAML front matter for site generation. - Combine with pre-commit hooks to automatically format markdown while respecting front matter structure. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. mdformat-frontmatter is an mdformat plugin that preserves YAML front matter blocks at the start of markdown files, preventing them from being reformatted or removed during markdown formatting operations. Yes, if you use mdformat with markdown files that contain YAML front matter. The plugin is actively maintained, has no security vulnerabilities, and solves a specific but real problem for Jekyll users and documentation projects. Install it only if you need front matter preservation; it adds no value for plain markdown files. ## Install pip install mdformat-frontmatter uv add mdformat-frontmatter poetry add mdformat-frontmatter ## Installing mdformat-frontmatter Before you install: Low friction install with three straightforward runtime dependencies (mdformat, mdit-py-plugins, ruamel-yaml). The package is actively maintained with a recent release and no known vulnerabilities. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects. Quickstart: pip install mdformat-frontmatter import mdformat markdown_text = """--- test: yaml --- # Heading Content here.""" formatted = mdformat.text(markdown_text) Requires Python 3.10 or higher. Verify before relying: - Whether the plugin handles edge cases like malformed YAML front matter gracefully or if it produces unpredictable output as the description suggests. - Performance characteristics when processing large markdown files with complex front matter. - Compatibility with other mdformat plugins when used together in a formatting pipeline. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags mdformat plugin yaml frontmatter, markdown frontmatter preservation, jekyll yaml front matter markdown, mdformat frontmatter support, yaml metadata markdown formatter, markdown front matter plugin, preserve yaml headers markdown, markdown-formatting, static-site-generation, jekyll [View on SkillFed](https://skillfed.io/packages/mdformat-frontmatter) · [View on PyPI](https://pypi.org/project/mdformat-frontmatter/)