black on python code blocks in documentation files.
pip install blacken-docs
blacken-docs provides a single executable (
blacken-docs) which will modify
.md files in place.
It currently supports the following
Following additional parameters can be used:
blacken-docs will format code in the following block types:
```python def hello(): print("hello world") ```
.. code-block:: python def hello(): print("hello world")
usage with pre-commit
See pre-commit for instructions
- repo: https://github.com/asottile/blacken-docs rev: v0.3.0 hooks: - id: blacken-docs additional_dependencies: [black==...]
black is currently a moving target, it is suggested to pin
to a specific version using