
mdformat-black
Mdformat plugin to Blacken Python code blocks
Description
mdformat-black is an mdformat plugin
that makes mdformat format Python code blocks with Black.
Usage
Install with:
pip install mdformat-black
When using mdformat on the command line, Black formatting will be automatically enabled after install.
When using mdformat Python API, code formatting for Python will have to be enabled explicitly:
import mdformat
unformatted = "```python\n'''black converts quotes'''\n```\n"
formatted = mdformat.text(unformatted, codeformatters={"python"})
assert formatted == '```python\n"""black converts quotes"""\n```\n'