CommonMark compliant Markdown formatter with python
Mdformat
Mdformat is an opinionated Markdown formatter that can be used to enforce a consistent style in Markdown files. Mdformat is a Unix-style command-line tool as well as a Python library.
Installing
Install with CommonMark support:
pip install mdformat
Alternatively install with GitHub Flavored Markdown (GFM) support:
pip install mdformat-gfm
Or with Markedly Structured Text (MyST) support:
pip install mdformat-myst
Command line usage
Format files
Format files README.md
and CHANGELOG.md
in place
mdformat README.md CHANGELOG.md
Format .md
files in current working directory recursively
mdformat .
Read Markdown from standard input until EOF
.
Write formatted Markdown to standard output.
mdformat -
Check formatting
mdformat --check README.md CHANGELOG.md