Registry / serialization / mdformat-myst

mdformat-myst

JSON →
library0.3.0pypypi✓ verified 85d ago

mdformat-myst is a plugin for the mdformat Markdown formatter, providing compatibility with MyST (Markedly Structured Text) Markdown syntax. It enables mdformat to correctly parse and format MyST-specific elements like directives, roles, and math blocks. The current version is 0.3.0, and it follows an active release cadence, frequently updating to support new mdformat features and MyST specifications.

pip install mdformat-myst
INSTALL
IMPORT
SIG · MDFORMAT-MYST
M
mdformat-myst
serializationpythonv0.3.0
Install
2.8s avg
Import
110ms
Disk
24MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.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.910 runs
installs and imports cleanly · install 0.0s · import 0.114s · 28.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.8s · import 0.106s · 29MB
24MB installed
● package 24MB
Code
Verified usage

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

mdformat.text
from mdformat import text
mdformat-myst is typically used by passing its name ('myst') as an extension to mdformat, rather than direct import of mdformat-myst itself. The mdformat.text function is the primary programmatic interface.

To use mdformat-myst, you invoke `mdformat` from the command line or use its Python API, specifying `myst` as an enabled extension or plugin. The plugin automatically integrates with `mdformat` to handle MyST-specific syntax. The example demonstrates programmatic usage; for command line, save the MyST markdown to a file and run `mdformat <file> --plugin myst`.

import os from mdformat import text # Example Markdown with MyST syntax myst_markdown = """ --- title: MyST Example author: Me --- # MyST Title ````{myst-role} This is a myst role content. ```` $$a^2 + b^2 = c^2$$ :::{note} This is a MyST directive. ::: """ # --- Command Line Usage --- # For command line, save the content to a file, e.g., 'example.md' # Then run: mdformat example.md --plugin myst # --- Python API Usage --- formatted_text = text(myst_markdown, extensions=("myst",)) print(formatted_text) # To verify it's formatted by mdformat-myst # Note: This is a simplified check, actual verification requires inspecting output assert ':::{note}' in formatted_text or '$a^2 + b^2 = c^2$' in formatted_text, \ "MyST specific elements should be preserved/formatted."
mdformat --version
Debug
Known issues
breakingPython 3.8 support was dropped in version 0.2.2. Users on Python 3.8 or older will need to upgrade their Python version to 3.10+ or pin mdformat-myst to a version prior to 0.2.2.
fix
Upgrade Python to 3.10 or newer. For projects requiring older Python, pin `mdformat-myst<0.2.2`.
affects: >=0.2.2
breakingIn version 0.3.0, the internal dependency for table formatting changed from `mdformat-tables` to `mdformat-gfm`. If your project explicitly relied on `mdformat-tables` for MyST table formatting, you should now ensure `mdformat-gfm` is installed and properly configured if you were not already using it. This is automatically handled if you just `pip install mdformat-myst`.
fix
Ensure `mdformat-gfm` is installed. If manually managing `mdformat` plugins, remove `mdformat-tables` and add `mdformat-gfm`.
affects: >=0.3.0
breakingVersion 0.3.0 replaced `mdformat-frontmatter` with `mdformat-front-matters` for handling front matter. This is a name change of a required dependency. Users with specific pinning of `mdformat-frontmatter` might experience issues.
fix
Update your `requirements.txt` or `pyproject.toml` to use `mdformat-front-matters` instead of `mdformat-frontmatter`, ensuring the correct version is installed.
affects: >=0.3.0
gotchamdformat-myst is an extension for mdformat; it does not provide a standalone executable. To use it, you must install `mdformat` separately and then invoke `mdformat` with the `--plugin myst` flag or `extensions=('myst',)` in the Python API.
fix
Always use `mdformat` as the entry point: `mdformat <file> --plugin myst` or `mdformat.text(..., extensions=('myst',))`.
affects: All versions
Errors
Common errors & fixes
Error: Unknown plugin: myst
The `mdformat-myst` package is not installed or `mdformat` cannot find it.
fix
Run `pip install mdformat-myst` to ensure the plugin is installed in the same environment as `mdformat`.
AttributeError: 'RootRenderer' object has no attribute 'render_dollarmath'
This usually indicates an incompatibility between `mdformat-myst` and the core `mdformat` version, or a missing required dependency.
fix
Ensure `mdformat` and all its direct dependencies (e.g., `mdit-py-plugins`) are compatible with your `mdformat-myst` version. Try `pip install --upgrade mdformat mdformat-myst`.
mdformat: error: unrecognized arguments: --plugin myst
This error means mdformat itself is installed, but `mdformat-myst` is not, or the installed `mdformat` version is too old to support the `--plugin` flag or dynamic plugin loading, or the plugin name 'myst' is not recognized.
fix
Verify `mdformat-myst` is installed and `mdformat` is up-to-date (`pip install --upgrade mdformat mdformat-myst`). Also ensure the correct plugin name `myst` is used.
SyntaxError: invalid syntax (mdformat_myst.py, line XX)
You are likely running an older Python version than required. `mdformat-myst>=0.2.2` requires Python 3.10+.
fix
Upgrade your Python environment to 3.10 or newer. If you must use an older Python, downgrade `mdformat-myst` to `<0.2.2`.
Upgrade
Version history
0.3.0latest on PyPI · released Nov 27, 2025
Audit
Dependencies
mdformatrequiredCore dependency; mdformat-myst is a plugin for mdformat.
mdformat-front-mattersrequiredRequired for handling MyST front-matter blocks.
mdformat-gfmrequiredRequired for handling MyST-compatible tables, replacing mdformat-tables.
mdformat-footnoterequiredRequired for handling MyST-compatible footnotes.
Agent activity
4 hits · last 30 days
node
4
Resources