Giter Club home page Giter Club logo

Comments (7)

asottile avatar asottile commented on June 8, 2024

no, sorry -- for the same reasons as #3

it's not simply passing through the option as we don't even access the part of black that does checking -- it would be implementing it and supporting it here which I am not interested in doing

thanks for the issue anyway!

from blacken-docs.

shamrin avatar shamrin commented on June 8, 2024

Could you please reconsider? Unfortunately, we can't depend on pre-commit tool.

You are right that it's not enough to pass --check to black. However, the implementation was almost trivial. I've implemented it before seeing your message: PR #43

from blacken-docs.

asottile avatar asottile commented on June 8, 2024

no, I don't want to support that feature

from blacken-docs.

asottile avatar asottile commented on June 8, 2024

note that you can already use the exit code (this tool returns nonzero when making changes)

from blacken-docs.

shamrin avatar shamrin commented on June 8, 2024

Ok, no problem!

Thank you for info about the exit code. However, I don't want blacken-docs to change files under me in this case.

By the way, I've found a work-around for non-destructive format checking:

./markdowncode README.md | black --check --diff -

markdowncode is a small script that extracts all Python code blocks:

#!/usr/bin/env python3
"""Extract Python code blocks from markdown file"""

import re
import sys
from textwrap import indent

doc = open(sys.argv[1])
blocks = re.findall(r"\n```python\n(.*?)\n```", doc.read(), re.DOTALL)
print(
    "\n\n\n".join(
        f'def test_{i}():\n{indent(block, " " * 4)}' for i, block in enumerate(blocks)
    )
)

from blacken-docs.

asottile avatar asottile commented on June 8, 2024

cool, thanks for sharing

from blacken-docs.

asottile avatar asottile commented on June 8, 2024

@shamrin not a place for advertising

from blacken-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.