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.

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

Uploaded Source

Built Distribution

clang_format_docs-0.2.0-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for clang_format_docs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3fd9557ed007e5016cdac69a11753655be93906e3153e4a3b9c51a902972f21c
MD5 c180fada7bf15d22a8635ad8fa70d26f
BLAKE2b-256 c0ffc0383e3146cc978389f20e97fdacd24762c032cc62dd7596c249d29d8d8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for clang_format_docs-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e359b28a59b99b98ed572d80307075c862dacc1509d9ddfeb8aa0d2d745788ec
MD5 0e757a1ea464f22d6ee92967219a21de
BLAKE2b-256 c868459ff5e186b1b309b71472cb72373ed6390b76cdc1a6325a7cb5ee5249da

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