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

clang_format_docs-0.3.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

clang_format_docs-0.3.2-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.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

Hashes for clang_format_docs-0.3.2.tar.gz
Algorithm Hash digest
SHA256 f8732874b99cecd238665c17a8e9fda3edd875638ce56de545c7ecd6c341ee3d
MD5 066d6b6bff6edfbfdae4d8da7d069312
BLAKE2b-256 f02fdbe1ede44848732161d9ca6448245798bf31c03a1ef322630a6c99f3341d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for clang_format_docs-0.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c16210d21a47e76acdd95c72e137fd574f42c5a961d86e7347a0e3a019ab86a6
MD5 bf53f721999e96117cb50ed7df28300b
BLAKE2b-256 1400c31d7b7c2a53923bfc63a431853ef5cb5178a1a454e42c82f26c4e010391

See more details on using hashes here.

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

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