Concordion > Specification Types > Markdown >

Concordion Markdown Grammar

Since: Concordion 2.0.0

With the Markdown extension, Concordion commands are expressed using Markdown links, for example:

[value](- "command")

This format separates the instrumentation (command) from the specification (value). When viewed with a Markdown editor only the specification is shown, with the instrumentation displayed as a title when you hover over the value. The URL has to be set to -, otherwise it will be treated as a normal Markdown link.

The Markdown extension converts the Markdown to XHTML, with the instrumentation as attributes, prior to running Concordion with the XHTML format specification as input.

This specification describes the grammar for the Markdown instrumentation and checks that it generates correctly formatted instrumentation in XHTML.

Link Styles

The extension supports both inline links and reference links.

In both styles, the text value is delimited by square brackets.

Inline Links

Inline links have a set of regular parentheses immediately after the link text’s closing square bracket. Inside the parentheses are a - for the URL followed by a space followed by the command, surrounded in quotes (either single or double quotes are allowed). For example:


Markdown Resultant HTML
[Jane Doe](- '#name') <span concordion:set="#name">Jane Doe</span>

Reference Links

As an alternative to inline links, reference links can be used. This can help make the Markdown source more readable, especially for table headers or lengthy commands.

Reference links have a set of square brackets immediately after the link text’s closing square bracket. The link definition can then be placed anywhere in the document. See the Markdown syntax page for more details.


Markdown Resultant HTML
My name is [Jane Doe][name]

[name]: - "?=getFullName()"
My name is <span concordion:assert-equals="getFullName()">Jane Doe</span>

If the link text is the same as the link name, you can use implicit links:


Markdown Resultant HTML
will be [split][] into

[split]: - "#result = split(#name)"
will be <span concordion:execute="#result = split(#name)">split</span> into


Expression-only commands

Some commands only require an expression and don't need a text value to be passed. However, Markdown links always require link text.

Any text value that starts with italics will be set to an empty text value in the output specification.


Markdown Resultant HTML
[_set time_](- "setCurrentTime(#time)") <span concordion:execute="setCurrentTime(#time)"></span>

Arbitrary Commands

Any Concordion command can be included in the title of the Markdown link by using the prefix c:.

Note that, unlike HTML format specifications, the expression is not enclosed in additional quotes. Neither are the value of any additional parameters passed to the command.


Markdown Resultant HTML
[value](- "c:command=expression")              
<span concordion:command="expression">value</span>
[value](- "c:command=expression param=x")              
<span concordion:command="expression" param="x">value</span>
[value](- "c:command=expression param1=x param2=y")              
<span concordion:command="expression" param1="x" param2="y">value</span>

Embedding HTML

For cases where the Markdown syntax is too restrictive, you can inline HTML.

This can be used to embed Concordion structures that are not currently supported by the Markdown syntax.

Execute on a list

The execute on a list command can be implemented using the HTML list structure, wrapped in a <div> element. For example:

    <ol concordion:execute="parseNode(#TEXT, #LEVEL)">

Handling unusual sentence structures

In order to handle unusual sentence structures, Concordion allows you to use an execute command on an outer HTML element. When using Markdown, this can be implemented using the HTML structure wrapped in a <div>.

    <p concordion:execute="#greeting = greetingFor(#firstName)">
        The greeting "<span concordion:assertEquals="#greeting">Hello Bob!</span>"
        should be given to user <span concordion:set="#firstName">Bob</span>
        when he logs in.

Non-Concordion links

The set, assert-equals and execute commands require the link URL to be set to -. Links with other URLs are not modified. For example:


Markdown Resultant HTML
[John](- "#a") <span concordion:set="#a">John</span>
[John](john.html) <a href="john.html">John</a>
[John](john.html "Details about John") <a href="john.html" title="Details about John">John</a>
[John](john.html "#More about John") <a href="john.html" title="#More about John">John</a>
[John](-.html "Weird URL") <a href="-.html" title="Weird URL">John</a>
[John](.) <a href=".">John</a>
[John](#) <a href="#">John</a>

Support for Concordion commands in other namespaces, eg extensions

In order to include Concordion commands with namespaces other than the default Concordion namespaces, such as those available in extensions, you must declare the namespace.

Add the @ConcordionOptions annotation to the fixture class, with the declareNamespaces element set to a list of strings, where the values alternate between namespace prefixes and the namespace they are mapped to. For example:

@ConcordionOptions(declareNamespaces={"ext", "urn:concordion-extensions:2010"})
public class MyFixture

The namespaced command can then be included in the title of the Markdown link, using the prefix declared in the annotation.


Markdown Resultant HTML
[-](- "ext:embed=getDetails()") <span ext:embed="getDetails()">-</span>

Additional checks

Command formatted

Commands can be formatted with bold or italic text


Markdown Resultant HTML
__[a](- "#b")__ <strong><span concordion:set="#b">a</span></strong>
*[c](- "#d")* <em><span concordion:set="#d">c</span></em>

Multiple commands on a single line

Multiple commands on the same line are supported.


Markdown Resultant HTML
[1](- "#x") + [2](- "#y") = [3](- "?=add(#x,#y)") <span concordion:set="#x">1</span> + <span concordion:set="#y">2</span> = <span concordion:assert-equals="add(#x,#y)">3</span>
[3](- "?=three()"). [Fred](- "#name"). <span concordion:assert-equals="three()">3</span>. <span concordion:set="#name">Fred</span>.

HTML entities

HTML entities in the text value are automatically escaped.


Markdown Resultant HTML
[& < 3](- "#x") <span concordion:set="#x">&amp; &lt; 3</span>
[<div>](- "#d") <span concordion:set="#d">&lt;div&gt;</span>
[<div class="x">](- "#d") <span concordion:set="#d">&lt;div class=&quot;x&quot;&gt;</span>
[<request>](- "#d") <span concordion:set="#d">&lt;request&gt;</span>
[<div><br/></div>](- "#d") <span concordion:set="#d">&lt;div&gt;&lt;br/&gt;&lt;/div&gt;</span>
[<?xml version='1.0' encoding='UTF-8'?>](- "#decl") <span concordion:set="#decl">&lt;?xml version='1.0' encoding='UTF-8'?&gt;</span>
[& < 3](- "c:set=#x") <span concordion:set="#x">&amp; &lt; 3</span>
[<div>](- "c:set=#d") <span concordion:set="#d">&lt;div&gt;</span>
[& < 3][] [& < 3]: - "c:set=#x" <span concordion:set="#x">&amp; &lt; 3</span>
[<div>][xx] [xx]: - "#d" <span concordion:set="#d">&lt;div&gt;</span>
|[foo](- "foo()")|[a < b](- "#d")|[x>](- "?=#d")| | -------------- | ------------- | ------------ | | bar | a < b | x>| <table concordion:execute="foo()"> <thead> <tr><th></th><th concordion:set="#d">a &lt; b</th><th concordion:assert-equals="#d">x&gt;</th></tr> </thead> <tbody> <tr><td> bar </td><td> a &lt; b </td><td> x&gt;</td></tr> </tbody> </table>

Extended character set


Markdown Resultant HTML
é é