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.

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.2.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.2.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

clang_format_docs-0.2.1-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: clang_format_docs-0.2.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for clang_format_docs-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f19b5ffa193c1493424c701d2b630001f41cbf9e1f2f5cef4082824d8b901ca4
MD5 14fb94d73eb5b66999fcc193b36a2ff9
BLAKE2b-256 433e09b58b0f7057b358fbe11d7aa6646b8650624b9dbda736b1728bedf90c5c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for clang_format_docs-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5d42ebc9a76ca8f4d7c71b6298d97c2a51fe297f4f07f94379b632cdb3ba6035
MD5 395e7b0dc0caf7af29b139f26b672ffd
BLAKE2b-256 86e87d7a2457d482212f403928f9fbba651aa43265500ce2116dc3afc1741a56

See more details on using hashes here.

Supported by

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