This specification defines the Markdown syntax, a very simple text markup for giving a minimum of structure to a text and still making it readable.

This document has not been approved by any group yet. The intent is to produce a strawmann document which can be used by the Markdown Community Group for defining what should be in a Markdown Specification.

Introduction

Markdown is a text syntax created by John Gruber. etc. The content of the markup defined in this document is based on the initial Markdown Syntax as defined by John Gruber. The document might address syntax extension later on.

Conformance Section

Define what/who implements the specification.

Syntax

End Of Line (EOL) sequence

An EOL sequence consists of all characters and character sequences which can indicate the end of a line of input in a Markdown file.

Processing

An EOL sequence is defined as any of the following character sequences:

Test Cases

Should all Unicode characters considered to mean the end of the line be recognized? (see Wikipedia Newline article)

As far as I can tell, embedding different EOL characters in a single text document is not doable by me. I've created separate files to test, but that leaves us in the cold re: example text for this definition. I've included tests for each EOL (to make sure they are detected properly).

HTML output

The output will be dependent on the block-level element being processed. See (list of block-elements and cross-referenctial anchor tags goes here) for more information.

For purposes of illustration, all the tests above should result in the following (identical) output.

These lines all end with end of line (EOL) sequences.

Seriously, they really do.

If you don't believe me: HEX EDIT!

Standalone Paragraph

A standalone paragraph is a unit of text on one or more contiguous lines. Authors can use 0 to 3 leading spaces and 1 trailing space.

Examples

This is a paragraph on a single line.

This is another paragraph
but on multiple lines.

 This is another way
 to create paragraphs
 with leading spaces.

Processing

A paragraph starts with 0 to 3 spaces (U+0020) followed by any characters, except the following characters * (U+002A), - (U+002D), + (U+002B), >(U+003E).

A paragraph ends with an EOL sequence followed by:

Should a parser remove the leading characters spaces.

To test tabs at the ends of a carriage return. See paragraph-trailing-tab.md test.

What is happening to a multiline paragraph when converted to HTML? normalize as a long line, kept as is with the carriage return? What about eventual leading and trailing spaces.

Test Cases

HTML output

An HTML producer MUST output a P element start tag followed by the content and MUST end with the P element end tag.

Addressing the trailing/leading space characters in the processing or in the HTML output. Maybe better in the processing section to be able to produce in more than one format.

Line break

A line break is a way for authors to break a paragraph in the middle. Authors can use two trailing spaces and a return at the end of a line to insert a line break in a paragraph.

Examples

This is a paragraph␠␠
with an effective line break.

Processing

A line break is created when there are two trailing spaces characters (U+0020) followed by an EOL sequence.

To test what is happening with 3 or more trailing spaces.

To test what is happening when this is the end of the paragraph. Should it be removed or kept.

HTML output

An HTML producer MUST output a BR element.

Headings

A heading is a string of text for marking up headings with 1 to 6 levels. The heading must be on one and only one line. It must not have any leading space characters. There are 3 ways of marking up headings.

Leading Hash sign
The author must must put hash sign (#) at the beginning of the line followed by 0 or 1 space and the heading string. 1 hash sign for a level 1 heading to 6 hash signs for a level 6 heading.
Nesting Hash sign
In addition to the previous rules for leading hash sign, the author must close with 0 to 1 space and the same number of hash signs #.
Underlines (level 1 and 2 only)
For level 1 heading, the author must put at the next line after the heading string a series of equal signs (=) of the same length than the heading.
For level 2 heading, the author must put at the next line after the heading string a series of dash signs (-) of the same length than the heading.

Examples

# Heading level 1
## Heading level 2
### Heading level 3
#### Heading level 4
##### Heading level 5
###### Heading level 6

# Heading level 1 #
## Heading level 2 ##
### Heading level 3 ###
#### Heading level 4 ####
##### Heading level 5 #####
###### Heading level 6 ######

Heading level 1
===============

Heading level 2
---------------

Processing

.

trailing hash signs are not significant. This has to be explained clearly in the processing part.

leading spaces are forbidden. To check.

Is the length of the undeline string (=, -) significant. To check. Seems not.

Verify the combination of # and underline markup.

HTML output

What should be the output

Reserved characters

Reserved characters are used for marking up a markdown prose in some circumstances. It includes backtick `, asterisk *, underscore _, curly braces {}code>, square brackets[], parentheses (), hash mark #, plus sign +, minus sign (hyphen) -, dot ., exclamation mark !. Their behavior is dependent of the position in the text. Authors can escape these characters with a backslash character (\)

Examples

\\   backslash
\`   backtick
\*   asterisk
\_   underscore
\{\}  curly braces
\[\]  square brackets
\(\)  parentheses
\#   hash mark
\+   plus sign
\-   minus sign (hyphen)
\.   dot
\!   exclamation mark

Processing

How a parser should process the feature.@describe the step and the unicode character.

Describe precisely when the characters is not escaped.

Tests Needed for different circumstances.

HTML output

The producer tool must output the reserved characters as it is defined.

Markdown filename extension

An extension filename is a common way to identify a file on a Operating System and for authoring tools. Currently there are a number of extensions which have been used in the wild for handling markdown documents. Here is a list of some of these

Should there be only one normative extension filename for everyone to use? And make a note for deprecating the others as parseable but not conformant for producing tools.

Markup layout style guidelines

Authors and authoring tools are encouraged to use a fixed-width font for editing markdown document. It will be a lot easier to read and write.

Acknowledgements

The editor would like to thank the following persons for contributing and helping in creating this document