Run `clang-format` on C++ code blocks in documentation files
Project description
clang-format-docs
Run clang-format
on C++ code blocks in documentation files.
This project is derivative work of 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.2.0
hooks:
- id: clang-format-docs
additional_dependencies: [clang-format==14.0.6]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for clang_format_docs-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d42ebc9a76ca8f4d7c71b6298d97c2a51fe297f4f07f94379b632cdb3ba6035 |
|
MD5 | 395e7b0dc0caf7af29b139f26b672ffd |
|
BLAKE2b-256 | 86e87d7a2457d482212f403928f9fbba651aa43265500ce2116dc3afc1741a56 |