Markdown and Embedding Images

You can include markdown code in your feature files, and use markdown to embed images in your feature files. These images will then be displayed when viewing the living documentation in Azure DevOps. Note: Markdown is only supported in Feature and Scenario descriptions. This means you can only place markdown between the “Feature:” row and the first scenario, or between the “Scenario:” row and the first step definition. If you place markdown elsewhere, you will receive errors when building the documentation.

Embedding Images

When embedding images, the path to the image can be specified as a relative or absolute path. You can also embed images stored externally, such as on a website. Paths are relative to the location of the feature file.

Embedding an image in the same directory as the feature file

![Alt text](image.png)

Embedding an image in a sub-directory

![Alt text](folder/image.png)

Embedding an image with an absolute reference

![Alt text](/folder/image.png)

Embedding an image relative to the parent directory

![Alt text](../image.png)

Embedding an external image

![Alt text](HTTPS://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQyBVE0UKugTT3yaJZ7fpr1nVK_RC9R5853AodqdLWMcsDl4PQw)

Example

The following code contains a link to an image in in the Feature description:

Feature: Everybody on the same page
![Swing](https://specflow.org/wp-content/uploads/2017/09/swing-sm.png)
    In order to ensure our software is fit-for-purpose
    As a conscientious software developer
    I want to share specifications with all stakeholders

@mytag
Scenario: Embed image
    Given I have added an embedded image to my feature file using markdown
    When I view the resulting living documentation SpecFlow+LivingDoc
    Then I see the image embedded inline

This is the resulting output in SpecFlow+ LivingDoc:

https://specflow.org/screenshots/Everybody-on-same-page.pngImage in Gherkin

Internal linking between features and scenarios

You can link your features by their feature file name in feature or scenario descriptions. The location of the linked feature file is defined by your folder structure.

Linking a feature in the root directory

[Link text](root/Feature.feature)

Linking a feature in a sub-directory

[Link text](root/sub-directory/Feature.feature)

Linking Example

The following code contains a link to a feature in the Scenario description:

Feature: Referencing feature files

Scenario: Creating a reference of a feature file in a scenario description
You can find the calculator feature here [Calculator](Features/Calculator.feature)

    Given I have the root folder 'Features'
    When I add the MarkDown '[Calculator](Features/Calculator.feature)' to a scenario description
    Then SpecFlow+ LivingDoc should create the hyperlink 'Calculator' in the scenario description

Scenario: Navigating to a feature file from a scenario description

    Given SpecFlow+ LivingDoc created the hyperlink 'Calculator' in the scenario description
    When I click on the hyperlink in SpecFlow+ LivingDoc 'Calculator'
    Then I should be navigated to the feature 'Calculator' in the tree 'Features/Calculator.feature'

This is the resulting output in SpecFlow+ LivingDoc:

../_images/Internal-Linking.pngInternal link in Gherkin