All Projects → asottile → Blacken Docs

asottile / Blacken Docs

Licence: mit
Run `black` on python code blocks in documentation files

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Blacken Docs

Expo Docs
This repo will be replaced soon. Please hold off on PRs to this repo.
Stars: ✭ 147 (-20.11%)
Mutual labels:  docs
Mm Wiki
MM-Wiki 一个轻量级的企业知识分享与团队协同软件,可用于快速构建企业 Wiki 和团队知识分享平台。部署方便,使用简单,帮助团队构建一个信息共享、文档管理的协作环境。
Stars: ✭ 2,364 (+1184.78%)
Mutual labels:  docs
Typescript Definitive Guide
TypeScript: Definitive Guide (book and docs in one)
Stars: ✭ 169 (-8.15%)
Mutual labels:  docs
Larecipe
🍪 Write gorgeous documentation for your products using Markdown inside your Laravel app.
Stars: ✭ 1,953 (+961.41%)
Mutual labels:  docs
Symfony Docs
The Symfony documentation
Stars: ✭ 1,924 (+945.65%)
Mutual labels:  docs
Riot Cheatsheet
🚩 Riot at a glance
Stars: ✭ 159 (-13.59%)
Mutual labels:  docs
Vuecommunity
Vue.js community and ecosystem guide, written and maintained by the community itself
Stars: ✭ 143 (-22.28%)
Mutual labels:  docs
Owl Ui
🦉 基于 Vue 开发移动端UI组件库 🎉附UI组件库开发教程
Stars: ✭ 177 (-3.8%)
Mutual labels:  docs
Jsdoc
An API documentation generator for JavaScript.
Stars: ✭ 12,555 (+6723.37%)
Mutual labels:  docs
Ng Aquila
Angular UI Component library for the Open Insurance Platform
Stars: ✭ 170 (-7.61%)
Mutual labels:  docs
Markdown Doctest
Test all the code in your markdown docs!
Stars: ✭ 149 (-19.02%)
Mutual labels:  docs
Typemill
TYPEMILL is a simple and lightweight Flat-File-CMS for authors and publishers.
Stars: ✭ 150 (-18.48%)
Mutual labels:  docs
Sentry Docs
The new place for the sentry documentation (and tools to build it)
Stars: ✭ 160 (-13.04%)
Mutual labels:  docs
Mapbox.js
Mapbox JavaScript API, a Leaflet Plugin
Stars: ✭ 1,819 (+888.59%)
Mutual labels:  docs
Edit Text
Collaborative rich text editor for the web. Written in Rust + WebAssembly.
Stars: ✭ 171 (-7.07%)
Mutual labels:  docs
Extract React Types
One stop shop to document your react components.
Stars: ✭ 141 (-23.37%)
Mutual labels:  docs
Docs
Various Yii 3.0 related documentation
Stars: ✭ 159 (-13.59%)
Mutual labels:  docs
Press
Minimalist Markdown Publishing for Nuxt.js
Stars: ✭ 181 (-1.63%)
Mutual labels:  docs
Typeorm Nestjs Migration Example
"Example of how to use migrations feature of TypeORM with NestJS.
Stars: ✭ 176 (-4.35%)
Mutual labels:  docs
Webpack.js.org
Repository for webpack documentation and more!
Stars: ✭ 2,049 (+1013.59%)
Mutual labels:  docs

Build Status Azure DevOps coverage pre-commit.ci status

blacken-docs

Run black on python code blocks in documentation files.

install

pip install blacken-docs

usage

blacken-docs provides a single executable (blacken-docs) which will modify .rst / .md / .tex files in place.

It currently supports the following black options:

  • -l / --line-length
  • -t / --target-version
  • -S / --skip-string-normalization

Following additional parameters can be used:

  • -E / --skip-errors

blacken-docs will format code in the following block types:

(markdown)

    ```python
    def hello():
        print("hello world")
    ```

(markdown pycon)

    ```pycon

    >>> def hello():
    ...     print("hello world")
    ...

    ```

(rst)

    .. code-block:: python

        def hello():
            print("hello world")

(rst pycon)

    .. code-block:: pycon

        >>> def hello():
        ...     print("hello world")
        ...

(latex)

\begin{minted}{python}
def hello():
    print("hello world")
\end{minted}

(latex with pythontex)

\begin{pycode}
def hello():
    print("hello world")
\end{pycode}

(markdown/rst in python docstrings)

def f():
    """docstring here

    .. code-block:: python

        print("hello world")

    ```python
    print("hello world")
    ```
    """

usage with pre-commit

See pre-commit for instructions

Sample .pre-commit-config.yaml:

-   repo: https://github.com/asottile/blacken-docs
    rev: v1.10.0
    hooks:
    -   id: blacken-docs
        additional_dependencies: [black==...]

Since black is currently a moving target, it is suggested to pin black to a specific version using additional_dependencies.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].