Chyrp Flavoured Markdown

Chyrp Lite has its own flavour of Markdown, the syntax for writing structured documents in plain text. Chyrp-Flavoured Markdown implements most of Github-Flavored Markdown and extends it with some extra features that make it easier to write blog-style articles.

Syntax

The syntax of Github-Flavored Markdown is described in extensive detail. Below is an overview of that specification as implemented by Chyrp-Flavoured Markdown, and a description of the features added to it. The formatting applied to a text document by a Markdown parser can be divided into two broad categories, which are described below: inline and block.

Limitations

To be as fast and efficient as possible, Chyrp-Flavoured Markdown is more limited than Github-Flavored Markdown.

The most notable limitations are:

  1. It does not support indentation with intermingled tabs and spaces;
  2. It does not recognize setext headings that span multiple lines;
  3. It does not allow "lazy" continuation lines in blockquotes or lists.

Inline formatting

Inline elements do not disrupt the flow of text and can be used in almost any location within a Markdown document. Most inline elements can contain other inline elements.

Strong

Strong text is delimited by the characters ** or __. The opening and closing delimiters must match.

Markdown formatting:

This is **strong text**
This is __strong text__

HTML output:

This is <strong>strong text</strong>
This is <strong>strong text</strong>

Emphasis

Emphasised text is delimited by the character * or _. The opening and closing delimiters must match.

Markdown formatting:

This text has *emphasis*
This text has _emphasis_

HTML output:

This text has <em>emphasis</em>
This text has <em>emphasis</em>

Citations

A citation is delimited by the opening characters *_ and the closing characters _*.

Markdown formatting:

This is a *_citation_*

HTML output:

This is a <cite>citation</cite>

Strikethrough

Struck through text is delimited by the characters ~~.

Markdown formatting:

This text has a ~~strikethrough~~

HTML output:

This text has a <del>strikethrough</del>

Inline Code

Inline code is delimited by one or more ` characters.

Markdown formatting:

This is `inline code` and so is ``this``.

HTML output:

This is <code>inline code</code> and so is <code>this</code>

Highlighting

Highlighted text is delimited by the characters ==.

Markdown formatting:

This text has a ==highlight==

HTML output:

This text has a <mark>highlight</mark>

Superscript and Subscript

Superscript text is delimited by the characters ++. Subscript text is delimited by the characters --.

Markdown formatting:

This text ++superscript++ and this text is --subscript--

HTML output:

This text is <sup>superscript</sup> and this text is <sub>subscript</sub>

Hyperlinks are defined by a title contained within [], followed by a URL contained within ().

Markdown formatting:

This is a hyperlink [title](URL) in the text

HTML output:

This is a hyperlink <a href="URL">title</a> in the text

Images

Images are defined by the ! character, followed by a description contained within [], followed by a URL contained within ().

Markdown formatting:

![description](URL)

HTML output:

<img src="URL" alt="description">

Block formatting

Block elements are the containers for the flow of text in a Markdown document. Only some block elements can contain other block elements, but almost all block elements can contain inline elements.

Paragraphs

A sequence of non-blank lines forms a paragraph. The paragraph element is the default container for the flow of text in a Markdown document.

Markdown formatting:

This is a paragraph.
It continues until a blank line is encountered,

or the parser reaches the end of the document.

HTML output:

<p>This is a paragraph.
It continues until a blank line is encountered,</p>
<p>or the parser reaches the end of the document.</p>

Hard Line Breaks

A line break can be forced by ending a line of text with two or more spaces, or a \.

Markdown formatting:

This is a sentence  
with a line break,\
created in two ways.

HTML output:

<p>This is a sentence<br>
with a line break,<br>
created in two ways.</p>

Headings

A heading is identified by a line of text starting with 1-6 # characters, or a line of text immediately followed by a line of the characters = or -.

Markdown formatting:

# This is a heading
## This is a heading
### This is a heading
#### This is a heading
##### This is a heading
###### This is a heading

This is a heading
=================

This is a heading
-----------------

HTML output:

<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6>This is a heading</h6>
<h1>This is a heading</h1>
<h2>This is a heading</h2>

Horizontal Rules

A horizontal rule is defined by a line containing 3 or more of the characters *, -, or _. Up to three spaces may precede the characters, and spaces can be intermingled with the characters.

Markdown formatting:

***
---
___

HTML output:

<hr>
<hr>
<hr>

Pre-formatted Code Blocks

A pre-formatted code block can be indented or fenced. An indented code block is defined by a series of lines beginning with 4 or more spaces and surrounded by blank lines. Indented code blocks can contain breaks of multiple blank lines; a line that is not blank and not indented will end the code block. A fenced code block is defined by a series of lines delimited by 3 or more ` or ~ characters; the same characters must be used to start and end the block.

Markdown formatting:


    This is a code block
    Every line must be indented

    but breaks are allowed

```
This is a code block
```

~~~
This is a code block
~~~

HTML output:

<pre><code>This is a code block
Every line must be indented

but breaks are allowed</code></pre>

<pre><code>This is a code block</code></pre>

<pre><code>This is a code block</code></pre>

Unordered and Ordered Lists

A list can be unordered or ordered. Unordered lists are defined by a series of lines beginning with the characters -, +, or *, followed by at least one space. Ordered lists are defined by a series of lines beginning with a number followed by ) or ., followed by at least one space. Lists can be loose or tight: items in a loose list are separated by blank lines and will be rendered as paragraphs; items in a tight list are not separated by blank lines.

Markdown formatting:

- Item
- Item
- Item

1. Item
2. Item
3. Item

- Item

- Item

- Item

HTML output:

<ul>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ul>

<ol>
<li>Item</li>
<li>Item</li>
<li>Item</li>
</ol>

<ul>
<li><p>Item</p></li>
<li><p>Item</p></li>
<li><p>Item</p></li>
</ul>

Blockquotes

A blockquote can be indented or fenced. An indented blockquote is defined by a series of lines beginning with the character >. A line not beginning with > will end the blockquote. A fenced blockquote is defined by a series of lines delimited by 3 or more > characters; at least as many characters must be used to end the block as were used to start it.

Markdown formatting:

> This is a blockquote

>>>
This is a fenced blockquote
>>>

HTML output:

<blockquote>
<p>This is a blockquote</p>
</blockquote>

<blockquote>
<p>This is a fenced blockquote</p>
</blockquote>

HTML

HTML blocks are groups of lines that are treated as raw HTML and rendered without modification. HTML blocks are defined by a line beginning with the character <, followed by an opening or closing tag, !--, ?, !, or ![CDATA[. Most but not all HTML block types can interrupt a paragraph without requiring a blank line.

Markdown formatting:

<!-- Foo

bar
   baz -->
A new paragraph

HTML output:

<!-- Foo

bar
   baz -->
<p>A new paragraph</p>

Tables

Tables are defined by a single header row with column header cells separated by the character |, a delimiter row, and zero or more data rows with data cells separated by |. A delimiter row is a row of cells separated by |, having as their content only the characters - and optionally a leading and/or trailing character : to indicate alignment.

Markdown formatting:

| foo | bar |
| --- | --- |
| baz | bim |

| abc | def | xyz |
|:---:|----:|:----|
| foo | bar | baz |

HTML output:

<table>
<thead>
<tr>
<th>foo</th>
<th>bar</th>
</tr>
</thead>
<tbody>
<tr>
<td>baz</td>
<td>bim</td>
</tr>
</tbody>
</table>

<table>
<thead>
<tr>
<th align="center">abc</th>
<th align="right">def</th>
<th align="left">xyz</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">foo</td>
<td align="right">bar</td>
<td align="left">baz</td>
</tr>
</tbody>
</table>

Asides

An aside can be indented or fenced. An indented aside is defined by a series of lines beginning with the character <, followed by a space. The space following the marker is essential to differentiate between asides and HTML blocks. A line not beginning with < will end the aside. A fenced aside is defined by a series of lines delimited by 3 or more < characters; at least as many characters must be used to end the block as were used to start it.

Markdown formatting:

< This is an aside, otherwise known as a call-out

<<<
This is a fenced aside
<<<

HTML output:

<aside>
<p>This is an aside, otherwise known as a call-out</p>
</aside>

<aside>
<p>This is a fenced aside</p>
</aside>

Figures and Captions

Figures are defined by a series of lines beginning with the character :. Figures can optionally include a caption, which is defined by a series of lines beginning with the characters ::. Captions must be defined at the beginning or end of a figure, otherwise they will be ignored. A line not beginning with : or :: will end the figure.

Markdown formatting:

: This is a figure

: This is a figure
:: This is a caption

:: This is a caption
: This is a figure

: > Therefore, send not to know\
: > For whom the bell tolls,\
: > It tolls for thee.
:: Figures and captions can contain block and __inline__ formatting

: ![description](URL)
:: This caption is for a figure containing an image

HTML output:

<figure>
<p>This is a figure</p>
</figure>

<figure>
<p>This is a figure</p>
<figcaption>
<p>This is a caption</p>
</figcaption>
</figure>

<figure>
<figcaption>
<p>This is a caption</p>
</figcaption>
<p>This is a figure</p>
</figure>

<figure>
<blockquote>
<p>Therefore, send not to know<br>
For whom the bell tolls,<br>
It tolls for thee.<br>
</p>
</blockquote>
<figcaption>
<p>Figures and captions can contain block and <strong>inline</strong> formatting</p>
</figcaption>
</figure>

<figure>
<p><img src="URL" alt="description"></p>
<figcaption>
<p>This caption is for a figure containing an image</p>
</figcaption>
</figure>

Footnotes

Footnotes are defined by a line beginning with the characters [^, followed by an author-defined label, followed by the characters ]:, followed by a series of lines defining one or more blocks of footnote content. Footnote content can optionally be indented up to the same width as the footnote marker. Two blank lines will end the current list of footnote definitions; this rule allows footnotes to contain multiple paragraphs.

Footnote references are defined by the characters [^, followed by the footnote label, followed by the character ].

Markdown formatting:

A *simple* footnote[^1] reference, and one with a label.[^label] Labels can be anything.[^✳&|^"]

[^label]: Labelled footnote (number 2)
with multiple lines.
[^1]: The *first* footnote, with [inline](https://example.org/) formatting.
[^✳&|^"]: Any characters are allowed.


Footnotes can be defined out of order (both where they're called and defined).
Block elements such as headers, lists, and quotes can contain footnotes,
and footnotes can contain block elements. One footnote can be referenced multiple times.

HTML output:

<p>
A <em>simple</em> footnote
<sup id="fnref-1" class="footnote-ref"><a href="#fn-1" role="doc-noteref">1</a></sup>
reference, and one with a label.
<sup id="fnref-2" class="footnote-ref"><a href="#fn-2" role="doc-noteref">2</a></sup>
Labels can be anything.
<sup id="fnref-3" class="footnote-ref"><a href="#fn-3" role="doc-noteref">3</a></sup>
</p>
<p>
Footnotes can be defined out of order (both where they're called and defined).
Block elements such as headers, lists, and quotes can contain footnotes,
and footnotes can contain block elements. One footnote can be referenced multiple times.
</p>

<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn-1">
<p>The <em>first</em> footnote, with <a href="https://example.org/">inline</a> formatting.</p>
<p class="footnote-backrefs"><a href="#fnref-1" role="doc-backlink">↩︎</a></p>
</li>
<li id="fn-2">
<p>Labelled footnote (number 2)
with multiple lines.</p>
<p class="footnote-backrefs"><a href="#fnref-2" role="doc-backlink">↩︎</a></p>
</li>
<li id="fn-3">
<p>Any characters are allowed.</p>
<p class="footnote-backrefs"><a href="#fnref-3" role="doc-backlink">↩︎</a></p>
</li>
</ol>
</div>