matthiasnoback / gherkin-features-html-exporter
A tool for exporting Gherkin features to HTML
Requires
- php: >=7.4
- behat/gherkin: ^4.8
- league/commonmark: ^1.5
- symfony/console: ^4.4|^5.2
- thecodingmachine/safe: ^1.3
- wa72/html-pretty-min: ^0.2.0
Requires (Dev)
- behat/behat: ^3.8
- phpstan/phpstan: ^0.12.83
- phpunit/phpunit: ^9.5
README
This library uses behat/gherkin
(which is also used by Behat) to parse .feature
files and renders HTML pages that you can style yourself, export to PDF, and show to other stakeholders.
Getting started
Install using Composer:
composer require --dev matthiasnoback/gherkin-features-html-exporter
Usage
vendor/bin/export-gherkin [features/] [export/] --stylesheet style.css
The stylesheet is optional and should be present in the provided [export/]
directory.
For each .feature
file in [features/]
a corresponding .html
file will be generated in [export/]
.
Combine features by tag
Another way to use this tool is to combine all features with a given tag in a single .html
file named by that tag:
vendor/bin/export-gherkin [features/] [export/] --stylesheet style.css --tag wip
This will find all features tagged @wip
and store them in a file called [export/]wip.html
.
Reformat HTML
There's an option to reformat the HTML before saving it:
vendor/bin/export-gherkin [features/] [export/] --reformat
Demo
You'll find an example.feature
in the demo folder, together with its generated example.html
. The style.css
can be used as an example stylesheet. example.html
was generated by running:
bin/export-gherkin demo demo --stylesheet style.css --reformat