Format Markdown files with mdformat, an
opinionated formatter for enforcing a consistent style.
The extension runs mdformat in an isolated environment managed by
uv. It does not install mdformat globally or
modify the project's Python environment.
Requirements
uv installed and available on PATH to the VS Code extension host.
- Network access the first time uv resolves mdformat or a plugin. Later runs
normally use uv's cache.
Usage
Open a Markdown document and select Format Document With..., then choose
mdformat for VS Code. To make it the default Markdown formatter:
{
"[markdown]": {
"editor.defaultFormatter": "gerecj.mdformat-vscode"
}
}
Settings
Plugins
mdformat.pluginPackages lists Python package requirements that uv uses with
mdformat. mdformat-gfm and mdformat-frontmatter are included by default.
{
"mdformat.pluginPackages": [
"mdformat-gfm",
"mdformat-frontmatter"
]
}
Arguments
mdformat.args provides additional mdformat CLI arguments. The extension uses --no-validate by default.
{
"mdformat.args": ["--no-validate"]
}
See mdformat's command-line options
for the available arguments.
An applicable .mdformat.toml takes priority over mdformat.args.
wrap = 88
number = false
end_of_line = "keep"
validate = false
extensions = ["gfm", "frontmatter"]
How it runs
The effective command is equivalent to:
uv tool run --isolated --with mdformat-gfm --with mdformat-frontmatter mdformat -