Registry / serialization / mdformat-front-matters

mdformat-front-matters

JSON →
library2.0.0pypypi✓ verified 84d ago

An mdformat plugin for formatting YAML, TOML, or JSON front matter in Markdown files. Current version: 2.0.0. Release cadence is irregular; major version bumps when there are breaking changes in mdformat or plugin API.

pip install mdformat-front-matters
INSTALL
IMPORT
SIG · MDFORMAT-FRONT-MAT
M
mdformat-front-matters
serializationpythonv2.0.0
Install
2.3s avg
Import
358ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.298s · 21.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.3s · import 0.274s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mdformat_front_matters
import mdformat_front_matters
No common mistake—just import the package to register the plugin automatically.

Importing the plugin automatically registers it with mdformat. Then use mdformat.text() or mdformat.file() as usual.

import mdformat_front_matters import mdformat # Format a markdown string with YAML front matter formatted = mdformat.text('---\ntitle: My Doc\n---\n\nHello, world!', options={ 'wrap': 80, 'end_of_line': 'lf' }) print(formatted)
Debug
Known issues
breakingVersion 2.0.0 drops support for Python <3.10. Ensure you're using Python 3.10+.
fix
Upgrade Python to 3.10 or higher.
affects: 2.0.0+
deprecatedThe option --front-matter-style has been renamed to --prefer-style. Old style may be removed in future.
fix
Update CLI or API calls to use `prefer_style` instead of `front_matter_style`.
affects: >=2.0.0
gotchaPlugin auto-registers on import; if you import it after calling mdformat functions, plugin won't be active.
fix
Ensure `import mdformat_front_matters` is called before any mdformat formatting.
affects: all
gotchaWhen using with other mdformat plugins, ordering may affect behavior if multiple plugins modify front matter. Check plugin priority.
fix
Explicitly list plugins in `mdformat` options or control plugin loading order via Python code.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'mdformat_front_matters' from 'mdformat_front_matters'
Incorrect import path: the package is not a module with submodules; just `import mdformat_front_matters` works.
fix
Use `import mdformat_front_matters` without any submodule.
mdformat.errors.MdformatConfigError: Unknown option 'front_matter_style'
Option name changed in v2.0.0 from `front_matter_style` to `prefer_style`.
fix
Use `prefer_style` instead of `front_matter_style` in mdformat options.
FileNotFoundError: [Errno 2] No such file or directory: '...' (when using mdformat.file())
mdformat.file() expects a path to an existing file. This is a general mdformat gotcha.
fix
Ensure the file path is correct and the file exists.
Upgrade
Version history
2.0.0latest on PyPI · released Dec 4, 2025
Audit
Dependencies
mdformatrequiredCore required dependency
tomlioptionalRequired for TOML front matter parsing (Python <3.11)
pyyamloptionalUsed for YAML front matter parsing
Agent activity
3 hits · last 30 days
node
2
Meta
1
Resources
mdformat-front-matters — pip install mdformat-front-matters · libregistry