Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Markdown Parsing to Reduce Unintended Block Quotes #302

Closed
dirkrombauts opened this issue Mar 8, 2016 · 1 comment
Closed

Improve Markdown Parsing to Reduce Unintended Block Quotes #302

dirkrombauts opened this issue Mar 8, 2016 · 1 comment

Comments

@dirkrombauts
Copy link
Member

dirkrombauts commented Mar 8, 2016

The situation

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.

@dirkrombauts
Copy link
Member Author

Released in version 2.10.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant