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.3.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.3.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: clang_format_docs-0.3.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for clang_format_docs-0.3.1.tar.gz
Algorithm Hash digest
SHA256 1bb4089c040ad5bca46eded3f145c6700f4a01419eb8a15277e481b70fb7f4d5
MD5 0b6d0cda958710f524b4b11c12d3c074
BLAKE2b-256 4771cde3a97d5bdc6b86e6b3d5bc5a128ddb2a8dd9e7514e166fb67ecc62548c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for clang_format_docs-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 90d9efdd20ea289c8337dc0e3b5ff411051eccebaa4b2a9603bca8ab07c3864b
MD5 0650181d7352ca01e501d25a3a94b155
BLAKE2b-256 409ddf08b3f3b15ef247bfeaa04fbc7789db58af06239cf9f34571df218ad358

See more details on using hashes here.

Provenance

The following attestation bundles were made for clang_format_docs-0.3.1-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 Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page