You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible in Gherkin to provide free-text descriptions for the Feature and Scenario parts in a .feature file. Pickles parses them as MarkDown and generates formatted HTML code.
In MarkDown, indented text is rendered as a code block. However, SpecFlow provides an indented description block ("As a math idiot ...") by default, and many people like to arrange all their description text indented.
That leads to a lot of code blocks in the output of Pickles.
So for example, the description in this feature
Scenario: Addition of Two Numbers
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
will result in this code block in Pickles
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
A Possible Solution
Before the markdown processor transforms the description element, we remove the leading spaces from each line in the description element.
So
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
Will be trimmed to
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
However, real code blocks should be preserved.
So
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
This is a real code block
Will be trimmed to
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
This is a real code block
If there are blank lines in the description, that should not prevent us from trimming:
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
Another line after a blank line
Will be trimmed to
As a math idiot
In order to avoid mistakes
I want to be told the sum of two numbers
Another line after a blank line
Important
There should be unit tests to prove the functionality in detail.
The text was updated successfully, but these errors were encountered:
The situation
It is possible in Gherkin to provide free-text descriptions for the
Feature
andScenario
parts in a.feature
file. Pickles parses them as MarkDown and generates formatted HTML code.In MarkDown, indented text is rendered as a code block. However, SpecFlow provides an indented description block ("As a math idiot ...") by default, and many people like to arrange all their description text indented.
That leads to a lot of code blocks in the output of Pickles.
So for example, the description in this feature
will result in this code block in Pickles
A Possible Solution
Before the markdown processor transforms the description element, we remove the leading spaces from each line in the description element.
So
Will be trimmed to
However, real code blocks should be preserved.
So
Will be trimmed to
If there are blank lines in the description, that should not prevent us from trimming:
Will be trimmed to
Important
There should be unit tests to prove the functionality in detail.
The text was updated successfully, but these errors were encountered: