Skip to main content

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.4.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

clang_format_docs-0.4.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clang_format_docs-0.4.0-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file clang_format_docs-0.4.0.tar.gz.

File metadata

  • Download URL: clang_format_docs-0.4.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for clang_format_docs-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a9153ed21d4967a2f848e47e10cd48f1ad1f866415c606850cec46e7392f64c2
MD5 007a15423ba4cc65c0bbc3e9fac79267
BLAKE2b-256 ef2b5c8c7609e4b12429abb424181005601dac5cd401c4b68b2ab6477d838c97

See more details on using hashes here.

Provenance

The following attestation bundles were made for clang_format_docs-0.4.0.tar.gz:

Publisher: pypi.yml on finsberg/clang-format-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clang_format_docs-0.4.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for clang_format_docs-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 71fe0e2b5110f3a973ed031080e1ab92c2d533bbf3e50ca1cbf70262f5c85b72
MD5 ff7639850e6cef35ceb26b4eda800503
BLAKE2b-256 a5d02c5ed24b6fc6f9d347e7c72d4bcb7b94f8b5b66d9c9c37e3519f179ac23f

See more details on using hashes here.

Provenance

The following attestation bundles were made for clang_format_docs-0.4.0-py2.py3-none-any.whl:

Publisher: pypi.yml on finsberg/clang-format-docs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page