Concordion > Specification Types > Markdown >

Markdown example command

Since: Concordion 2.0.0

The example command is expressed using the form:

### [Header text](- "example name")

which creates:

```

Header text

...
```

where ### can be any level of header, using either atx or setext syntax.

You can also apply an status of ExpectedToFail, Ignored or Unimplemented to the example, for example:

### [Header text](- "example name c:status=ExpectedToFail")

Examples

Description Markdown Resultant HTML
h4 example using atx-style syntax
      
#### [Example 1](- "calculator")
x
        
<div concordion:example="calculator"> <h4>Example 1</h4> <p>x</p> </div>
h1 example using setext-style syntax
      
[Example 2](- "setext")
=====================================================
x
        
<div concordion:example="setext"> <h1>Example 2</h1> <p>x</p> </div>
Example with `ExpectedToFail` status
      
## [Cancel Transaction](- "cancel tx c:status=ExpectedToFail")
        
<div concordion:example="cancel tx" concordion:status="ExpectedToFail"> <h2>Cancel Transaction</h2> </div>

Auto-generated example name

If the example name is not specified, it will be generated from the header text. All alphanumeric characters from the header name will be included, with the alphabetic characters lowercased. Other characters will be converted to hyphens, with hyphens removed from the start and end of the header name.

Examples

Description Markdown Resultant HTML
Example with empty name
      
## [Example 3](- "")
x
        
<div concordion:example="example-3"> <h2>Example 3</h2> <p>x</p> </div>
Example with weird characters
      
## [3. Hmmm !@#$%^*( ](- "")
x
        
<div concordion:example="3-hmmm"> <h2>3. Hmmm !@#$%^*(</h2> <p>x</p> </div>
Example with multiple dashes
      
## [- A - B - - C -- -D - ](- "")
x
        
<div concordion:example="a-b-c-d"> <h2>- A - B - - C -- -D -</h2> <p>x</p> </div>

Closing an example

The example block continues until it is closed either implicitly or explicitly.

An example is implicitly closed on any of these conditions:

To explicitly close an example, create a header with the example heading struck-through. For example:

## ~~My Example~~

will close the example with the heading My Example.

Examples

Description Markdown Resultant HTML
Example automatically ended by start of another example
      
#### [Example 1](- "calculator")
x
#### [Example 2](- "another")
        
<div concordion:example="calculator"> <h4>Example 1</h4> <p>x</p> </div><div concordion:example="another"> <h4>Example 2</h4> </div>
Example is not automatically ended by a lower-level heading
      
#### [Example 1](- "calculator")
x
##### Subheading
        
<div concordion:example="calculator"> <h4>Example 1</h4> <p>x</p> <h5>Subheading</h5> </div>
Example is automatically ended by a higher-level heading
      
### [Example on h3](- "ex3")
My example
## head2
        
<div concordion:example="ex3"> <h3>Example on h3</h3> <p>My example</p> </div> <h2>head2</h2>
Example is not automatically ended by a same-level heading
      
#### [Example on h4](- "ex4")
My example
#### head4
        
<div concordion:example="ex4"> <h4>Example on h4</h4> <p>My example</p> <h4>head4</h4> </div>
Example ended by a strikethrough heading with the same title as the example
      
# [Example 1](- "calculator")
x
# ~~Example 1~~
y
        
<div concordion:example="calculator"> <h1>Example 1</h1> <p>x</p> </div> <p>y</p>
Example not ended by a strikethrough heading with a different title from the example
      
# [Example 6](- "calculator")
x
# ~~Example 7~~
y
        
<div concordion:example="calculator"> <h1>Example 6</h1> <p>x</p> <h1><del>Example 7</del></h1> <p>y</p> </div>
Example with single quote in name ended by a strikethrough heading with the same title as the example
# [Example 'One'](-)
x
# ~~Example 'One'~~
y
        
<div concordion:example="example-one"> <h1>Example 'One'</h1> <p>x</p> </div> <p>y</p>
Example with XML element in name ended by a strikethrough heading with the same title as the example
# [Example <One>](-)
x
# ~~Example <One>~~
y
        
<div concordion:example="example-one"> <h1>Example &lt;One&gt;</h1> <p>x</p> </div> <p>y</p>