Comments (7)
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.
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.
no, I don't want to support that feature
from blacken-docs.
note that you can already use the exit code (this tool returns nonzero when making changes)
from blacken-docs.
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.
cool, thanks for sharing
from blacken-docs.
@shamrin not a place for advertising
from blacken-docs.
Related Issues (20)
- A `--check` mode would be useful HOT 3
- Add option or switch default to use the same exit code behaviour as `black` HOT 3
- line number error with code-block:: python HOT 4
- Transform pandoc-style class injection/fenced code blocks HOT 2
- blacking docs with plot code directives HOT 1
- PS to #62 HOT 1
- Support black's --experimental-string-processing flag HOT 1
- Support for docstring inside docstrings HOT 1
- Add possibilities to skip blocks and lines? HOT 3
- RST: Detect `::` signifying default language code-block. HOT 12
- "--dry-run" flag HOT 7
- reStructuredText literal blocks within other directives
- Option to extend code block types HOT 7
- Blacken-docs does not work with tabbed indentation HOT 2
- Blacken-docs removes lines at beginning and end of codeblocks, thereby destroying the rst HOT 3
- Different exit codes for syntax errors and linting changes HOT 1
- Support formatting python code cells in Quarto document (`.qmd` extensions) HOT 1
- Fix incorrect README.md instruction HOT 2
- multi-line strings lead to incorrect syntax HOT 1
- Add support for notebook style code HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blacken-docs.