-
Notifications
You must be signed in to change notification settings - Fork 29
/
markdown-spec.html
315 lines (227 loc) · 12.8 KB
/
markdown-spec.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE html>
<html>
<head>
<title>Markdown Syntax Specification</title>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
<script src='http://darobin.github.com/respec/builds/respec-w3c-common.js' class='remove'></script>
<script class='remove'>
var respecConfig = {
// document info
specStatus: "unofficial",
shortName: "markdown",
// publishDate: "2009-08-06",
// previousMaturity: "WD",
// previousPublishDate: "2009-03-15",
// previousURI : "http://dev.w3.org/2009/dap/ReSpec.js/documentation.html",
copyrightStart: "2012",
edDraftURI: "http://htmlpreview.github.io/?https://github.com/karlcow/markdown-testsuite/blob/master/markdown-spec.html",
// lcEnd: "2010-08-06",
// editors
editors: [
{ name: "Karl Dubost", url: "http://www.la-grange.net/karl/",
company: "Mozilla", companyURL: "http://www.mozilla.org/" },
],
// WG
wg: "Markdown Community Group",
wgURI: "http://www.w3.org/community/markdown/",
wgPublicList: "public-markdown",
wgPatentURI: "",
};
</script>
</head>
<body>
<section id='abstract'>
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.
</section>
<section id='sotd'>
<p>
This document has not been approved by any group yet. The intent is to produce a strawmann document which can be used by the <a href="http://www.w3.org/community/markdown/">Markdown Community Group</a> for defining what should be in a Markdown Specification.
</p>
</section>
<section class='informative'>
<h2>Introduction</h2>
<p>
<dfn>Markdown</dfn> 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.
</p>
</section>
<section id='conformance'>
<h2>Conformance Section</h2>
<ul>
<li>author: (including authoring tools)</li>
<li>Markdown parser: </li>
<li>HTML producer: </li>
</ul>
<p class="issue">Define what/who implements the specification.</p>
</section>
<section>
<h2>Syntax</h2>
<!--template for writing a feature of the language
<h3>Feature name</h3>
<p>A <dfn>feature</dfn> is… [description].</p>
<h4 class="informative">Examples</h4>
<pre class="example">Example code</pre>
<h4>Processing</h4>
<p>How a parser should process the feature.@describe the step and the unicode character.</p>
<p class="issue">Describe Issue</p>
<h4>HTML output</h4>
<p>What should be the output</p>
-->
<h3>End Of Line (EOL) sequence</h3>
<p>An <dfn>EOL sequence</dfn> consists of all characters and character sequences which can indicate the end of a line of input in a Markdown file.</p>
<h4>Processing</h4>
<p>An EOL sequence is defined as any of the following character sequences:</p>
<ul>
<li>LF: Line Feed, U+000A
<li>CR: Carriage Return, U+000D
<li>CR+LF: CR (U+000D) followed by LF (U+000A)
</ul>
<h5 class="minisuite">Test Cases</h5>
<ul class="tests">
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/EOL-LF.md">Lines end with LF</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/EOL-CR.md">Lines end with CR</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/EOL-CR+LF.md">Lines end with CR+LF</a></li>
</ul>
<p class="issue">Should all Unicode characters considered to mean the end of the line be recognized? (see <a href="http://en.wikipedia.org/wiki/Newline">Wikipedia Newline article</a>)</p>
<p class="issue">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).</p>
<h4>HTML output</h4>
<p>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.</p>
<p>For purposes of illustration, all the tests above should result in the following (identical) output.</p>
<pre>
<p>These lines all end with end of line (EOL) sequences.</p>
<p>Seriously, they really do.</p>
<p>If you don't believe me: HEX EDIT!</p>
</pre>
<h3>Standalone Paragraph</h3>
<p>A <dfn>standalone paragraph</dfn> is a unit of text on one or more contiguous lines. Authors can use 0 to 3 leading spaces and 1 trailing space.</p>
<h4 class="informative">Examples</h4>
<pre class="example">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.</pre>
<h4>Processing</h4>
<p>A paragraph starts with 0 to 3 spaces (U+0020) followed by any characters, except the following characters <code>*</code> (U+002A), <code>-</code> (U+002D), <code>+</code> (U+002B), <code>></code>(U+003E).</p>
<p>A paragraph ends with an EOL sequence followed by:</p>
<ul>
<li>any spaces or tabs and another EOL sequence.</li>
<li>or End Of File</li>
</ul>
<p class="issue">Should a parser remove the leading characters spaces.</p>
<p class="issue">To test tabs at the ends of a carriage return. See paragraph-trailing-tab.md test.</p>
<p class="issue">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.</p>
<h5 class="minisuite">Test Cases</h5>
<ul class="tests">
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-hard-return.md">Multilines paragraph</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-line.md">Paragraph on a single long line</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-trailing-leading-spaces.md">Paragraph with 1 leading space and 1 trailing space</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraph-trailing-tab.md">Paragraph with 1 trailing tab</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-leading-space.md">Paragraph with 1 leading space</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-2-leading-spaces.md">Paragraph with 2 leading spaces</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-3-leading-spaces.md">Paragraph with 3 leading spaces</a></li>
<li><a href="https://github.com/karlcow/markdown-testsuite/blob/master/tests/paragraphs-trailing-spaces.md">Paragraph with 1 trailing space</a></li>
</ul>
<h4>HTML output</h4>
<p>An HTML producer MUST output a <code>P</code> element start tag followed by the content and MUST end with the <code>P</code> element end tag.</p>
<p class="issue">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.</p>
<h3>Line break</h3>
<p>A <dfn>line break</dfn> 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.</p>
<h4 class="informative">Examples</h4>
<pre class="example">This is a paragraph␠␠
with an effective line break.</pre>
<h4>Processing</h4>
<p>A line break is created when there are two trailing spaces characters (U+0020) followed by an EOL sequence.</p>
<p class="issue">To test what is happening with 3 or more trailing spaces.</p>
<p class="issue">To test what is happening when this is the end of the paragraph. Should it be removed or kept.</p>
<h4>HTML output</h4>
<p>An HTML producer MUST output a <code>BR</code> element.</p>
<h3>Headings</h3>
<p>A <dfn>heading</dfn> 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.</p>
<dl>
<dt>Leading Hash sign</dt>
<dd>The author must must put hash sign (<code>#</code>) 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.</dd>
<dt>Nesting Hash sign</dt>
<dd>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 <code>#</code>.</dd>
<dt>Underlines (<strong>level 1 and 2 only</strong>)</dt>
<dd>For level 1 heading, the author must put at the next line after the heading string a series of equal signs (<code>=</code>) of the same length than the heading.</dd>
<dd>For level 2 heading, the author must put at the next line after the heading string a series of dash signs (<code>-</code>) of the same length than the heading.</dd>
</dl>
<h4 class="informative">Examples</h4>
<pre class="example">
# 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
---------------
</pre>
<h4>Processing</h4>
<p>.</p>
<p class="issue">trailing hash signs are not significant. This has to be explained clearly in the processing part.</p>
<p class="issue">leading spaces are forbidden. To check.</p>
<p class="issue">Is the length of the undeline string (=, -) significant. To check. Seems not.</p>
<p class="issue">Verify the combination of # and underline markup.</p>
<h4>HTML output</h4>
<p>What should be the output</p>
<h3>Reserved characters</h3>
<p><dfn>Reserved characters</dfn> are used for marking up a markdown prose in some circumstances. It includes backtick <code>`</code>, asterisk <code>*</code>,
underscore <code>_</code>, curly braces <code>
{}</code>code>, square brackets<code>[]</code>, parentheses <code>()</code>, hash mark <code>#</code>, plus sign <code>+</code>, minus sign (hyphen) <code>-</code>, dot <code>.</code>, exclamation mark <code>!</code>. Their behavior is dependent of the position in the text. Authors can escape these characters with a backslash character (<code>\</code>)</p>
<h4 class="informative">Examples</h4>
<pre class="example">\\ backslash
\` backtick
\* asterisk
\_ underscore
\{\} curly braces
\[\] square brackets
\(\) parentheses
\# hash mark
\+ plus sign
\- minus sign (hyphen)
\. dot
\! exclamation mark</pre>
<h4>Processing</h4>
<p>How a parser should process the feature.@describe the step and the unicode character.</p>
<p class="issue">Describe precisely when the characters is not escaped.</p>
<p class="issue">Tests Needed for different circumstances.</p>
<h4>HTML output</h4>
<p>The producer tool must output the reserved characters as it is defined.</p>
</section>
<section>
<h2>Markdown filename extension</h2>
<p>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</p>
<ul>
<li>.md</li>
<li>.mdown</li>
<li>.markdown</li>
<li>.mkd</li>
<li>.markdn</li>
</ul>
<p class="issue">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.</p>
</section>
<section class="informative">
<h2>Markup layout style guidelines</h2>
<p>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.</p>
</section>
<section class='appendix'>
<h2>Acknowledgements</h2>
<p>The editor would like to thank the following persons for contributing and helping in creating this document</p>
<ul>
<li>Many thanks to <a href="http://daringfireball.net/">John Gruber</a> for creating the initial version of <a href="http://daringfireball.net/projects/markdown/">Markdown Syntax</a>.</li>
<li>Jeff Atwood for calling out on stabilizing the Markdown syntax. @@link to blog post@@</li>
<li><a href="http://www.dpawson.co.uk">Dave Pawson</a> for proposing the W3C Markdown Community Group.</li>
<li><a href="http://johnmacfarlane.net/babelmark2/">Babelmark2</a> by <a href="http://johnmacfarlane.net/">John MacFarlane</a> has been essential to stay in sync with the reality of current implementations.</li>
</ul>
</section>
</body>
</html>