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
. 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.3.2
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
File details
Details for the file clang_format_docs-0.3.2.tar.gz
.
File metadata
- Download URL: clang_format_docs-0.3.2.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8732874b99cecd238665c17a8e9fda3edd875638ce56de545c7ecd6c341ee3d |
|
MD5 | 066d6b6bff6edfbfdae4d8da7d069312 |
|
BLAKE2b-256 | f02fdbe1ede44848732161d9ca6448245798bf31c03a1ef322630a6c99f3341d |
Provenance
The following attestation bundles were made for clang_format_docs-0.3.2.tar.gz
:
Publisher:
pypi.yml
on finsberg/clang-format-docs
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
clang_format_docs-0.3.2.tar.gz
- Subject digest:
f8732874b99cecd238665c17a8e9fda3edd875638ce56de545c7ecd6c341ee3d
- Sigstore transparency entry: 186204107
- Sigstore integration time:
- Permalink:
finsberg/clang-format-docs@d1c818ccc7227fc380830d0541086a08c3138781
- Branch / Tag:
refs/tags/v0.3.2
- Owner: https://github.com/finsberg
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
pypi.yml@d1c818ccc7227fc380830d0541086a08c3138781
- Trigger Event:
push
- Statement type:
File details
Details for the file clang_format_docs-0.3.2-py2.py3-none-any.whl
.
File metadata
- Download URL: clang_format_docs-0.3.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c16210d21a47e76acdd95c72e137fd574f42c5a961d86e7347a0e3a019ab86a6 |
|
MD5 | bf53f721999e96117cb50ed7df28300b |
|
BLAKE2b-256 | 1400c31d7b7c2a53923bfc63a431853ef5cb5178a1a454e42c82f26c4e010391 |
Provenance
The following attestation bundles were made for clang_format_docs-0.3.2-py2.py3-none-any.whl
:
Publisher:
pypi.yml
on finsberg/clang-format-docs
-
Statement:
- Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
clang_format_docs-0.3.2-py2.py3-none-any.whl
- Subject digest:
c16210d21a47e76acdd95c72e137fd574f42c5a961d86e7347a0e3a019ab86a6
- Sigstore transparency entry: 186204110
- Sigstore integration time:
- Permalink:
finsberg/clang-format-docs@d1c818ccc7227fc380830d0541086a08c3138781
- Branch / Tag:
refs/tags/v0.3.2
- Owner: https://github.com/finsberg
- Access:
public
- Token Issuer:
https://token.actions.githubusercontent.com
- Runner Environment:
github-hosted
- Publication workflow:
pypi.yml@d1c818ccc7227fc380830d0541086a08c3138781
- Trigger Event:
push
- Statement type: