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.5.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.5.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.5.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.5.0.tar.gz.

File metadata

  • Download URL: clang_format_docs-0.5.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.5.0.tar.gz
Algorithm Hash digest
SHA256 1a470ab90962d403bfcfe6e19655e8728784a65778f95fdac418c58b5435ec4e
MD5 463e3e71fb2cc3e2fffebf3dec50e202
BLAKE2b-256 41f4b6a5baad090c7f3c23680e08df7686b05246d22ab7365fd3b31b519e8ae2

See more details on using hashes here.

Provenance

The following attestation bundles were made for clang_format_docs-0.5.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.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for clang_format_docs-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 395696a0ecfbe2e26b8a507a52fca9f113ac6f9ec04ed0d14a7242418d17fefa
MD5 7b1d3431cac00d746ecd4fe20f1cb902
BLAKE2b-256 defc47032bbf8e03bd31ef67dfe562c1d93c2460a0ef5b9c9d5f5ea291e80b22

See more details on using hashes here.

Provenance

The following attestation bundles were made for clang_format_docs-0.5.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