Features
- Formats Gherkin feature files within markdown code blocks
- Preserves all markdown formatting outside Gherkin code blocks
- Supports all standard Gherkin keywords and syntax
- Consistent formatting for better version control diffs
- Seamless integration with pre-commit hooks
Installation
pip install mdformat-gherkin
You may pin the reformat-gherkin dependency for formatting stability:
pip install mdformat-gherkin reformat-gherkin==v3.0.1
Usage
When using mdformat on the command line, Gherkin formatting will be automatically enabled after install.
When using mdformat Python API, code formatting for Gherkin will have to be enabled explicitly:
import mdformat
unformatted = """```gherkin
Feature: Test feature
Scenario: Test scenario
Given I have a test
When I run the test
Then it should pass
```"""
formatted = mdformat.text(unformatted, codeformatters={"gherkin"})
print(formatted)
Example
Before formatting:
```gherkin
Feature: Test feature
Scenario: Test scenario
Given I have a test
When I run the test
Then it should pass
```
After formatting with mdformat-gherkin:
```gherkin
Feature: Test feature
Scenario: Test scenario
Given I have a test
When I run the test
Then it should pass
```
Pre-commit Hook
You can use this plugin with pre-commit. Add the following to your .pre-commit-config.yaml:
- repo: https://github.com/executablebooks/mdformat
rev: 1.0.0 # Use the latest version
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gherkin
# Optional: pin specific versions
# - reformat-gherkin==v3.0.1
License
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Acknowledgments
This project is based on the work of reformat-gherkin.
Metadata
Release files for mdformat-gherkin 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mdformat_gherkin-0.1.0.tar.gz | 3.4 kB | Without provenance | Details for mdformat_gherkin-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mdformat_gherkin-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mdformat_gherkin-0.1.0-py3-none-any.whl |
Total release size: 7.4 kB
Release files / mdformat_gherkin-0.1.0.tar.gz
| Download URL | mdformat_gherkin-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b5231e412746cefd532178031b7f1fe344a9058398a0ae48ed43e2ce75de52a
|
|
BLAKE2b-256 checksum How to use checksums |
cd6b7151199679de2e8c58e19913e6ca4fabaf4293802accf812ad5de3192577
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / mdformat_gherkin-0.1.0-py3-none-any.whl
| Download URL | mdformat_gherkin-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd1f4827ecc571107822081077c01a48677e2a832e655bf197efb48ae29ecc69
|
|
BLAKE2b-256 checksum How to use checksums |
1a3f09e6cb25e13bc936ddbf1caa65f8147050fc8a9cf1c67f029d90e388296c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Security for mdformat-gherkin 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.