Metadata-Version: 2.1
Name: clang_format_docs
Version: 0.3.1
Summary: Run `clang-format` on C++ code blocks in documentation files
Author-email: Henrik Finsberg <henriknf@simula.no>
License: MIT
Project-URL: Homepage, https://github.com/finsberg/clang-format-docs
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE_blacken_docs
Requires-Dist: clang-format
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: ipython; extra == "dev"
Requires-Dist: pdbpp; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Provides-Extra: test
Requires-Dist: pre-commit; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"

clang-format-docs
=================

Run `clang-format` on C++ code blocks in documentation files.
This project is derivative work of [`blacken-docs`](https://github.com/adamchainz/blacken-docs). License from `blacken-docs` is included in [LICENSE_blacken_docs](LICENSE_blacken_docs)


## install

```bash
pip install clang-format-docs
```


## Usage

`clang-format-docs` will take markdown files and search for C++ code blocks e.g

```markdown
    ```c++
    void hello(){
        std::cout << "Hello world\n";
    }
    ```
```

and format them using `clang-format`, i.e
```bash
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](https://pre-commit.com) for instructions

Sample `.pre-commit-config.yaml`:


```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]
```
