spec.txt   spec.txt 
--- ---
title: CommonMark Spec title: CommonMark Spec
author: John MacFarlane author: John MacFarlane
version: 0.24 version: 0.25
date: '2016-01-12' date: '2016-03-24'
license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)' license: '[CC-BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/)'
... ...
# Introduction # Introduction
## What is Markdown? ## What is Markdown?
Markdown is a plain text format for writing structured documents, Markdown is a plain text format for writing structured documents,
based on conventions used for indicating formatting in email and based on conventions used for indicating formatting in email and
usenet posts. It was developed in 2004 by John Gruber, who wrote usenet posts. It was developed in 2004 by John Gruber, who wrote
skipping to change at line 302 skipping to change at line 302
. .
<ul> <ul>
<li> <li>
<p>foo</p> <p>foo</p>
<p>bar</p> <p>bar</p>
</li> </li>
</ul> </ul>
```````````````````````````````` ````````````````````````````````
```````````````````````````````` example ```````````````````````````````` example
>→foo→bar - foo
→→bar
.
<ul>
<li>
<p>foo</p>
<pre><code> bar
</code></pre>
</li>
</ul>
````````````````````````````````
```````````````````````````````` example
>→→foo
. .
<blockquote> <blockquote>
<p>foo→bar</p> <pre><code> foo
</code></pre>
</blockquote> </blockquote>
```````````````````````````````` ````````````````````````````````
```````````````````````````````` example ```````````````````````````````` example
-→→foo
.
<ul>
<li>
<pre><code> foo
</code></pre>
</li>
</ul>
````````````````````````````````
```````````````````````````````` example
foo foo
→bar →bar
. .
<pre><code>foo <pre><code>foo
bar bar
</code></pre> </code></pre>
```````````````````````````````` ````````````````````````````````
```````````````````````````````` example
- foo
- bar
→ - baz
.
<ul>
<li>foo
<ul>
<li>bar
<ul>
<li>baz</li>
</ul>
</li>
</ul>
</li>
</ul>
````````````````````````````````
## Insecure characters ## Insecure characters
For security reasons, the Unicode character `U+0000` must be replaced For security reasons, the Unicode character `U+0000` must be replaced
with the REPLACEMENT CHARACTER (`U+FFFD`). with the REPLACEMENT CHARACTER (`U+FFFD`).
# Blocks and inlines # Blocks and inlines
We can think of a document as a sequence of We can think of a document as a sequence of
[blocks](@)---structural elements like paragraphs, block [blocks](@)---structural elements like paragraphs, block
quotations, lists, headings, rules, and code blocks. Some blocks (like quotations, lists, headings, rules, and code blocks. Some blocks (like
skipping to change at line 1137 skipping to change at line 1181
baz baz
. .
<p>Foo <p>Foo
bar</p> bar</p>
<hr /> <hr />
<p>baz</p> <p>baz</p>
```````````````````````````````` ````````````````````````````````
or use a thematic break that cannot count as a [setext heading or use a thematic break that cannot count as a [setext heading
line], such as underline], such as
```````````````````````````````` example ```````````````````````````````` example
Foo Foo
bar bar
* * * * * *
baz baz
. .
<p>Foo <p>Foo
bar</p> bar</p>
<hr /> <hr />
skipping to change at line 8284 skipping to change at line 8328
If we encounter a new block start, we close any blocks unmatched If we encounter a new block start, we close any blocks unmatched
in step 1 before creating the new block as a child of the last in step 1 before creating the new block as a child of the last
matched block. matched block.
3. Finally, we look at the remainder of the line (after block 3. Finally, we look at the remainder of the line (after block
markers like `>`, list markers, and indentation have been consumed). markers like `>`, list markers, and indentation have been consumed).
This is text that can be incorporated into the last open This is text that can be incorporated into the last open
block (a paragraph, code block, heading, or raw HTML). block (a paragraph, code block, heading, or raw HTML).
Setext headings are formed when we see a line of a paragraph Setext headings are formed when we see a line of a paragraph
that is a setext heading line. that is a [setext heading underline].
Reference link definitions are detected when a paragraph is closed; Reference link definitions are detected when a paragraph is closed;
the accumulated text lines are parsed to see if they begin with the accumulated text lines are parsed to see if they begin with
one or more reference link definitions. Any remainder becomes a one or more reference link definitions. Any remainder becomes a
normal paragraph. normal paragraph.
We can see how this works by considering how the tree above is We can see how this works by considering how the tree above is
generated by four lines of Markdown: generated by four lines of Markdown:
``` markdown ``` markdown
 End of changes. 7 change blocks. 
6 lines changed or deleted 50 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/