clang-format-docs
Run clang-format on C++ code blocks in documentation files.
This project is derivative work of blacken-docs. License from blacken-docs is included in LICENSE_blacken_docs
install
pip install clang-format-docs
Usage
clang-format-docs will take markdown files and search for C++ code blocks e.g
```c++
void hello(){
std::cout << "Hello world\n";
}
```
and format them using clang-format, i.e
clang-format-docs file.md
will rewrite the file with clang-format applied. Also note that you can pass in a different format style using
clang-format-docs --style=LLVM file.md
or using a clang-format config file
clang-format-docs --style=file:my_clang_format.txt file.md
Usage with pre-commit
See pre-commit for instructions
Sample .pre-commit-config.yaml:
- repo: https://github.com/finsberg/clang-format-docs
rev: v0.6.0
hooks:
- id: clang-format-docs
additional_dependencies: [clang-format==14.0.6]
Metadata
Release files for clang-format-docs 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clang_format_docs-0.6.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clang_format_docs-0.6.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / clang_format_docs-0.6.0.tar.gz
| Download URL | clang_format_docs-0.6.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54dcd25a214132d692a5b072107b3ed905375aea4898f4199899fb90bf9147c6
|
|
BLAKE2b-256 checksum How to use checksums |
62f6760d6896256afb3d8a9f47559ebe703e5daade20cd89aca55420d4201b31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logRelease files / clang_format_docs-0.6.0-py2.py3-none-any.whl
| Download URL | clang_format_docs-0.6.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
77a343fb564299b8519e3cb2a882cf925302af9f4456a46d6d9ab8d3ba24b041
|
|
BLAKE2b-256 checksum How to use checksums |
9f0255019d31b72d10d340ce9442c55fc567bb24e5820370e7327167c55524a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency log