Lints Python code blocks in Markdown files using flake8
Project description
Flake8 Markdown
Flake8 Markdown lints GitHub-style Python code blocks in Markdown files using flake8.
This package helps improve a Python project's documentation by ensuring that code samples are error-free.
Features
- Lints code blocks containing regular Python and Python interpreter code (
pycon) - pre-commit hook to lint on commit
Installation
Flake8 Markdown can be installed from PyPI using pip or your package manager of choice:
pip install flake8-markdown
Usage
CLI
You can use Flake8 Markdown as a CLI tool using the flake8-markdown command.
flake8-markdown accepts one or more globs as its arguments.
Example:
$ flake8-markdown "tests/samples/*.md"
tests/samples/emphasized_lines.md:6:1: F821 undefined name 'emphasized_imaginary_function'
tests/samples/basic.md:8:48: E999 SyntaxError: EOL while scanning string literal
tests/samples/basic.md:14:7: F821 undefined name 'undefined_variable'
pre-commit hook
You can also add flake8-markdown to your project using pre-commit. When configured, any staged Markdown files will be linted using flake8-markdown once you run git commit.
To enable this hook in your local repository, add the following repo to your .pre-commit-config.yaml file:
# .pre-commit-config.yaml
repos:
- repo: https://github.com/johnfraney/flake8-markdown
rev: v0.5.0
hooks:
- id: flake8-markdown
Code of Conduct
Everyone interacting in the project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.
History
[0.5.0] - 2023-09-04
Added
- Added CI for
python3.11 - Added funding file
Removed
- Dropped support for
python3.7 and Pypy 3
[0.4.0] - 2022-09-11
Added
- Added support for
flake8v5 - Added support for
python3.10
Removed
- Dropped support for
python3.6
[0.3.0] - 2021-10-19
Added
- Added support for
flake8v4
[0.2.0] - 2019-06-14
Added
pyconcode block support
[0.1.1] - 2019-05-19
Changed
- Fixed pre-commit example in README
[0.1.0] - 2019-05-19
Added
- Added code for initial release
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8_markdown-0.6.0.tar.gz.
File metadata
- Download URL: flake8_markdown-0.6.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69d2a3d650ad6e995885c46c96963939eb28bd08f1832714ad09717b58848059
|
|
| MD5 |
88de0ee5ae8bb23d9b5eebe5906fec6c
|
|
| BLAKE2b-256 |
91b9419275fdeb2df233430dcc166956ea521e46e595cbd106b44a4ae4c8574b
|
Provenance
The following attestation bundles were made for flake8_markdown-0.6.0.tar.gz:
Publisher:
publish.yml on johnfraney/flake8-markdown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_markdown-0.6.0.tar.gz -
Subject digest:
69d2a3d650ad6e995885c46c96963939eb28bd08f1832714ad09717b58848059 - Sigstore transparency entry: 153335213
- Sigstore integration time:
-
Permalink:
johnfraney/flake8-markdown@51369e1b4bffe7fcd93d710e0dfe58874c595070 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/johnfraney
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@51369e1b4bffe7fcd93d710e0dfe58874c595070 -
Trigger Event:
push
-
Statement type:
File details
Details for the file flake8_markdown-0.6.0-py3-none-any.whl.
File metadata
- Download URL: flake8_markdown-0.6.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aaca329a5322aeace9e1bfdb3e0bb4c0c05cc611a7f4106a467dcb4e0224454
|
|
| MD5 |
dad3d4fe7a86e224ae23e21929d2d02f
|
|
| BLAKE2b-256 |
f95d2b8cec55b51be724945a9046c428140db7685fb7b49ac3fe2fd87f20a60c
|
Provenance
The following attestation bundles were made for flake8_markdown-0.6.0-py3-none-any.whl:
Publisher:
publish.yml on johnfraney/flake8-markdown
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flake8_markdown-0.6.0-py3-none-any.whl -
Subject digest:
4aaca329a5322aeace9e1bfdb3e0bb4c0c05cc611a7f4106a467dcb4e0224454 - Sigstore transparency entry: 153335219
- Sigstore integration time:
-
Permalink:
johnfraney/flake8-markdown@51369e1b4bffe7fcd93d710e0dfe58874c595070 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/johnfraney
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@51369e1b4bffe7fcd93d710e0dfe58874c595070 -
Trigger Event:
push
-
Statement type: