ronn-ng 0.10.1.pre1 → 0.10.1.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS +11 -7
  3. data/CHANGES +7 -1
  4. data/INSTALLING.md +29 -27
  5. data/LICENSE.txt +1 -1
  6. data/README.md +15 -9
  7. data/Rakefile +1 -1
  8. data/bin/ronn +1 -1
  9. data/lib/ronn/document.rb +4 -1
  10. data/lib/ronn/roff.rb +4 -0
  11. data/lib/ronn/template/default.html +1 -1
  12. data/lib/ronn.rb +4 -6
  13. data/man/index.html +14 -14
  14. data/man/index.txt +9 -9
  15. data/man/ronn-format.7 +2 -2
  16. data/man/ronn.1 +7 -7
  17. data/man/ronn.1.ronn +7 -6
  18. data/ronn-ng.gemspec +6 -69
  19. metadata +19 -80
  20. data/Gemfile +0 -2
  21. data/Gemfile.lock +0 -70
  22. data/test/angle_bracket_syntax.html +0 -27
  23. data/test/angle_bracket_syntax.roff +0 -24
  24. data/test/angle_bracket_syntax.ronn +0 -22
  25. data/test/backticks.html +0 -14
  26. data/test/backticks.ronn +0 -10
  27. data/test/basic_document.html +0 -8
  28. data/test/basic_document.ronn +0 -4
  29. data/test/circumflexes.ronn +0 -1
  30. data/test/code_blocks.html +0 -38
  31. data/test/code_blocks.roff +0 -38
  32. data/test/code_blocks.ronn +0 -41
  33. data/test/code_blocks_regression +0 -19
  34. data/test/code_blocks_regression.html +0 -38
  35. data/test/code_blocks_regression.ronn +0 -40
  36. data/test/contest.rb +0 -70
  37. data/test/custom_title_document.html +0 -6
  38. data/test/custom_title_document.ronn +0 -5
  39. data/test/definition_list_syntax.html +0 -25
  40. data/test/definition_list_syntax.roff +0 -19
  41. data/test/definition_list_syntax.ronn +0 -18
  42. data/test/dots_at_line_start_test.roff +0 -19
  43. data/test/dots_at_line_start_test.ronn +0 -12
  44. data/test/ellipses.roff +0 -7
  45. data/test/ellipses.ronn +0 -7
  46. data/test/entity_encoding_test.html +0 -42
  47. data/test/entity_encoding_test.roff +0 -51
  48. data/test/entity_encoding_test.ronn +0 -34
  49. data/test/index.txt +0 -8
  50. data/test/markdown_syntax.html +0 -954
  51. data/test/markdown_syntax.roff +0 -907
  52. data/test/markdown_syntax.ronn +0 -881
  53. data/test/middle_paragraph.html +0 -14
  54. data/test/middle_paragraph.roff +0 -9
  55. data/test/middle_paragraph.ronn +0 -10
  56. data/test/missing_spaces.roff +0 -7
  57. data/test/missing_spaces.ronn +0 -2
  58. data/test/nested_list.ronn +0 -19
  59. data/test/nested_list_with_code.html +0 -14
  60. data/test/nested_list_with_code.roff +0 -11
  61. data/test/nested_list_with_code.ronn +0 -6
  62. data/test/ordered_list.html +0 -28
  63. data/test/ordered_list.roff +0 -25
  64. data/test/ordered_list.ronn +0 -21
  65. data/test/page.with.periods.in.name.5.ronn +0 -4
  66. data/test/pre_block_with_quotes.roff +0 -8
  67. data/test/pre_block_with_quotes.ronn +0 -6
  68. data/test/section_reference_links.html +0 -16
  69. data/test/section_reference_links.roff +0 -7
  70. data/test/section_reference_links.ronn +0 -12
  71. data/test/single_quotes.html +0 -11
  72. data/test/single_quotes.roff +0 -5
  73. data/test/single_quotes.ronn +0 -9
  74. data/test/tables.ronn +0 -24
  75. data/test/test_ronn.rb +0 -124
  76. data/test/test_ronn_document.rb +0 -186
  77. data/test/test_ronn_index.rb +0 -73
  78. data/test/titleless_document.html +0 -9
  79. data/test/titleless_document.ronn +0 -3
  80. data/test/underline_spacing_test.roff +0 -13
  81. data/test/underline_spacing_test.ronn +0 -11
@@ -1,907 +0,0 @@
1
- .TH "MARKDOWN" "5" "January 1979" ""
2
- .SH "NAME"
3
- \fBmarkdown\fR \- humane markup syntax
4
- .SH "SYNOPSIS"
5
- .nf
6
- # Header 1 #
7
- ## Header 2 ##
8
- ### Header 3 ### (Hashes on right are optional)
9
- #### Header 4 ####
10
- ##### Header 5 #####
11
-
12
- This is a paragraph, which is text surrounded by whitespace\.
13
- Paragraphs can be on one line (or many), and can drone on for
14
- hours\.
15
-
16
- [Reference style links][1] and [inline links](http://example\.com)
17
- [1]: http://example\.com "Title is optional"
18
-
19
- Inline markup like _italics_, **bold**, and `code()`\.
20
-
21
- ![picture alt](/images/photo\.jpeg "Title is optional")
22
-
23
- > Blockquotes are like quoted text in email replies
24
- >> And, they can be nested
25
-
26
- code blocks are for preformatted
27
- text and must be indented with four spaces
28
-
29
- * Bullet lists are easy too
30
- * You can
31
- * even
32
- * nest them
33
- \- Another one
34
- + Another one
35
- .fi
36
- .SH "DESCRIPTION"
37
- .SS "Philosophy"
38
- Markdown is intended to be as easy\-to\-read and easy\-to\-write as is feasible\.
39
- .P
40
- Readability, however, is emphasized above all else\. A Markdown\-formatted document should be publishable as\-is, as plain text, without looking like it's been marked up with tags or formatting instructions\. While Markdown's syntax has been influenced by several existing text\-to\-HTML filters \-\- including Setext \fIhttp://docutils\.sourceforge\.net/mirror/setext\.html\fR, atx \fIhttp://www\.aaronsw\.com/2002/atx/\fR, Textile \fIhttp://textism\.com/tools/textile/\fR, reStructuredText \fIhttp://docutils\.sourceforge\.net/rst\.html\fR, Grutatext \fIhttp://www\.triptico\.com/software/grutatxt\.html\fR, and EtText \fIhttp://ettext\.taint\.org/doc/\fR \-\- the single biggest source of inspiration for Markdown's syntax is the format of plain text email\.
41
- .P
42
- To this end, Markdown's syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean\. E\.g\., asterisks around a word actually look like *emphasis*\. Markdown lists look like, well, lists\. Even blockquotes look like quoted passages of text, assuming you've ever used email\.
43
- .SS "Inline HTML"
44
- Markdown's syntax is intended for one purpose: to be used as a format for \fIwriting\fR for the web\.
45
- .P
46
- Markdown is not a replacement for HTML, or even close to it\. Its syntax is very small, corresponding only to a very small subset of HTML tags\. The idea is \fInot\fR to create a syntax that makes it easier to insert HTML tags\. In my opinion, HTML tags are already easy to insert\. The idea for Markdown is to make it easy to read, write, and edit prose\. HTML is a \fIpublishing\fR format; Markdown is a \fIwriting\fR format\. Thus, Markdown's formatting syntax only addresses issues that can be conveyed in plain text\.
47
- .P
48
- For any markup that is not covered by Markdown's syntax, you simply use HTML itself\. There's no need to preface it or delimit it to indicate that you're switching from Markdown to HTML; you just use the tags\.
49
- .P
50
- The only restrictions are that block\-level HTML elements \-\- e\.g\. \fB<div>\fR, \fB<table>\fR, \fB<pre>\fR, \fB<p>\fR, etc\. \-\- must be separated from surrounding content by blank lines, and the start and end tags of the block should not be indented with tabs or spaces\. Markdown is smart enough not to add extra (unwanted) \fB<p>\fR tags around HTML block\-level tags\.
51
- .P
52
- For example, to add an HTML table to a Markdown article:
53
- .IP "" 4
54
- .nf
55
- This is a regular paragraph\.
56
-
57
- <table>
58
- <tr>
59
- <td>Foo</td>
60
- </tr>
61
- </table>
62
-
63
- This is another regular paragraph\.
64
- .fi
65
- .IP "" 0
66
- .P
67
- Note that Markdown formatting syntax is not processed within block\-level HTML tags\. E\.g\., you can't use Markdown\-style \fB*emphasis*\fR inside an HTML block\.
68
- .P
69
- Span\-level HTML tags \-\- e\.g\. \fB<span>\fR, \fB<cite>\fR, or \fB<del>\fR \-\- can be used anywhere in a Markdown paragraph, list item, or header\. If you want, you can even use HTML tags instead of Markdown formatting; e\.g\. if you'd prefer to use HTML \fB<a>\fR or \fB<img>\fR tags instead of Markdown's link or image syntax, go right ahead\.
70
- .P
71
- Unlike block\-level HTML tags, Markdown syntax \fIis\fR processed within span\-level tags\.
72
- .SS "Automatic Escaping for Special Characters"
73
- In HTML, there are two characters that demand special treatment: \fB<\fR and \fB&\fR\. Left angle brackets are used to start tags; ampersands are used to denote HTML entities\. If you want to use them as literal characters, you must escape them as entities, e\.g\. \fB&lt;\fR, and \fB&amp;\fR\.
74
- .P
75
- Ampersands in particular are bedeviling for web writers\. If you want to write about 'AT&T', you need to write '\fBAT&amp;T\fR'\. You even need to escape ampersands within URLs\. Thus, if you want to link to:
76
- .IP "" 4
77
- .nf
78
- http://images\.google\.com/images?num=30&q=larry+bird
79
- .fi
80
- .IP "" 0
81
- .P
82
- you need to encode the URL as:
83
- .IP "" 4
84
- .nf
85
- http://images\.google\.com/images?num=30&amp;q=larry+bird
86
- .fi
87
- .IP "" 0
88
- .P
89
- in your anchor tag \fBhref\fR attribute\. Needless to say, this is easy to forget, and is probably the single most common source of HTML validation errors in otherwise well\-marked\-up web sites\.
90
- .P
91
- Markdown allows you to use these characters naturally, taking care of all the necessary escaping for you\. If you use an ampersand as part of an HTML entity, it remains unchanged; otherwise it will be translated into \fB&amp;\fR\.
92
- .P
93
- So, if you want to include a copyright symbol in your article, you can write:
94
- .IP "" 4
95
- .nf
96
- &copy;
97
- .fi
98
- .IP "" 0
99
- .P
100
- and Markdown will leave it alone\. But if you write:
101
- .IP "" 4
102
- .nf
103
- AT&T
104
- .fi
105
- .IP "" 0
106
- .P
107
- Markdown will translate it to:
108
- .IP "" 4
109
- .nf
110
- AT&amp;T
111
- .fi
112
- .IP "" 0
113
- .P
114
- Similarly, because Markdown supports \fIinline HTML\fR, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such\. But if you write:
115
- .IP "" 4
116
- .nf
117
- 4 < 5
118
- .fi
119
- .IP "" 0
120
- .P
121
- Markdown will translate it to:
122
- .IP "" 4
123
- .nf
124
- 4 &lt; 5
125
- .fi
126
- .IP "" 0
127
- .P
128
- However, inside Markdown code spans and blocks, angle brackets and ampersands are \fIalways\fR encoded automatically\. This makes it easy to use Markdown to write about HTML code\. (As opposed to raw HTML, which is a terrible format for writing about HTML syntax, because every single \fB<\fR and \fB&\fR in your example code needs to be escaped\.)
129
- .SH "BLOCK ELEMENTS"
130
- .SS "Paragraphs and Line Breaks"
131
- A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines\. (A blank line is any line that looks like a blank line \-\- a line containing nothing but spaces or tabs is considered blank\.) Normal paragraphs should not be indented with spaces or tabs\.
132
- .P
133
- The implication of the "one or more consecutive lines of text" rule is that Markdown supports "hard\-wrapped" text paragraphs\. This differs significantly from most other text\-to\-HTML formatters (including Movable Type's "Convert Line Breaks" option) which translate every line break character in a paragraph into a \fB<br />\fR tag\.
134
- .P
135
- When you \fIdo\fR want to insert a \fB<br />\fR break tag using Markdown, you end a line with two or more spaces, then type return\.
136
- .P
137
- Yes, this takes a tad more effort to create a \fB<br />\fR, but a simplistic "every line break is a \fB<br />\fR" rule wouldn't work for Markdown\. Markdown's email\-style \fIblockquoting\fR and multi\-paragraph \fIlist items\fR work best \-\- and look better \-\- when you format them with hard breaks\.
138
- .SS "Headers"
139
- Markdown supports two styles of headers, Setext \fIhttp://docutils\.sourceforge\.net/mirror/setext\.html\fR and atx \fIhttp://www\.aaronsw\.com/2002/atx/\fR\.
140
- .P
141
- Setext\-style headers are "underlined" using equal signs (for first\-level headers) and dashes (for second\-level headers)\. For example:
142
- .IP "" 4
143
- .nf
144
- This is an H1
145
- =============
146
-
147
- This is an H2
148
- \-\-\-\-\-\-\-\-\-\-\-\-\-
149
- .fi
150
- .IP "" 0
151
- .P
152
- Any number of underlining \fB=\fR's or \fB\-\fR's will work\.
153
- .P
154
- Atx\-style headers use 1\-6 hash characters at the start of the line, corresponding to header levels 1\-6\. For example:
155
- .IP "" 4
156
- .nf
157
- # This is an H1
158
-
159
- ## This is an H2
160
-
161
- ###### This is an H6
162
- .fi
163
- .IP "" 0
164
- .P
165
- Optionally, you may "close" atx\-style headers\. This is purely cosmetic \-\- you can use this if you think it looks better\. The closing hashes don't even need to match the number of hashes used to open the header\. (The number of opening hashes determines the header level\.) :
166
- .IP "" 4
167
- .nf
168
- # This is an H1 #
169
-
170
- ## This is an H2 ##
171
-
172
- ### This is an H3 ######
173
- .fi
174
- .IP "" 0
175
- .SS "Blockquotes"
176
- Markdown uses email\-style \fB>\fR characters for blockquoting\. If you're familiar with quoting passages of text in an email message, then you know how to create a blockquote in Markdown\. It looks best if you hard wrap the text and put a \fB>\fR before every line:
177
- .IP "" 4
178
- .nf
179
- > This is a blockquote with two paragraphs\. Lorem ipsum dolor sit amet,
180
- > consectetuer adipiscing elit\. Aliquam hendrerit mi posuere lectus\.
181
- > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus\.
182
- >
183
- > Donec sit amet nisl\. Aliquam semper ipsum sit amet velit\. Suspendisse
184
- > id sem consectetuer libero luctus adipiscing\.
185
- .fi
186
- .IP "" 0
187
- .P
188
- Markdown allows you to be lazy and only put the \fB>\fR before the first line of a hard\-wrapped paragraph:
189
- .IP "" 4
190
- .nf
191
- > This is a blockquote with two paragraphs\. Lorem ipsum dolor sit amet,
192
- consectetuer adipiscing elit\. Aliquam hendrerit mi posuere lectus\.
193
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus\.
194
-
195
- > Donec sit amet nisl\. Aliquam semper ipsum sit amet velit\. Suspendisse
196
- id sem consectetuer libero luctus adipiscing\.
197
- .fi
198
- .IP "" 0
199
- .P
200
- Blockquotes can be nested (i\.e\. a blockquote\-in\-a\-blockquote) by adding additional levels of \fB>\fR:
201
- .IP "" 4
202
- .nf
203
- > This is the first level of quoting\.
204
- >
205
- > > This is nested blockquote\.
206
- >
207
- > Back to the first level\.
208
- .fi
209
- .IP "" 0
210
- .P
211
- Blockquotes can contain other Markdown elements, including headers, lists, and code blocks:
212
- .IP "" 4
213
- .nf
214
- > ## This is a header\.
215
- >
216
- > 1\. This is the first list item\.
217
- > 2\. This is the second list item\.
218
- >
219
- > Here's some example code:
220
- >
221
- > return shell_exec("echo $input | $markdown_script");
222
- .fi
223
- .IP "" 0
224
- .P
225
- Any decent text editor should make email\-style quoting easy\. For example, with BBEdit, you can make a selection and choose Increase Quote Level from the Text menu\.
226
- .SS "Lists"
227
- Markdown supports ordered (numbered) and unordered (bulleted) lists\.
228
- .P
229
- Unordered lists use asterisks, pluses, and hyphens \-\- interchangably \-\- as list markers:
230
- .IP "" 4
231
- .nf
232
- * Red
233
- * Green
234
- * Blue
235
- .fi
236
- .IP "" 0
237
- .P
238
- is equivalent to:
239
- .IP "" 4
240
- .nf
241
- + Red
242
- + Green
243
- + Blue
244
- .fi
245
- .IP "" 0
246
- .P
247
- and:
248
- .IP "" 4
249
- .nf
250
- \- Red
251
- \- Green
252
- \- Blue
253
- .fi
254
- .IP "" 0
255
- .P
256
- Ordered lists use numbers followed by periods:
257
- .IP "" 4
258
- .nf
259
- 1\. Bird
260
- 2\. McHale
261
- 3\. Parish
262
- .fi
263
- .IP "" 0
264
- .P
265
- It's important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces\. The HTML Markdown produces from the above list is:
266
- .IP "" 4
267
- .nf
268
- <ol>
269
- <li>Bird</li>
270
- <li>McHale</li>
271
- <li>Parish</li>
272
- </ol>
273
- .fi
274
- .IP "" 0
275
- .P
276
- If you instead wrote the list in Markdown like this:
277
- .IP "" 4
278
- .nf
279
- 1\. Bird
280
- 1\. McHale
281
- 1\. Parish
282
- .fi
283
- .IP "" 0
284
- .P
285
- or even:
286
- .IP "" 4
287
- .nf
288
- 3\. Bird
289
- 1\. McHale
290
- 8\. Parish
291
- .fi
292
- .IP "" 0
293
- .P
294
- you'd get the exact same HTML output\. The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML\. But if you want to be lazy, you don't have to\.
295
- .P
296
- If you do use lazy list numbering, however, you should still start the list with the number 1\. At some point in the future, Markdown may support starting ordered lists at an arbitrary number\.
297
- .P
298
- List markers typically start at the left margin, but may be indented by up to three spaces\. List markers must be followed by one or more spaces or a tab\.
299
- .P
300
- To make lists look nice, you can wrap items with hanging indents:
301
- .IP "" 4
302
- .nf
303
- * Lorem ipsum dolor sit amet, consectetuer adipiscing elit\.
304
- Aliquam hendrerit mi posuere lectus\. Vestibulum enim wisi,
305
- viverra nec, fringilla in, laoreet vitae, risus\.
306
- * Donec sit amet nisl\. Aliquam semper ipsum sit amet velit\.
307
- Suspendisse id sem consectetuer libero luctus adipiscing\.
308
- .fi
309
- .IP "" 0
310
- .P
311
- But if you want to be lazy, you don't have to:
312
- .IP "" 4
313
- .nf
314
- * Lorem ipsum dolor sit amet, consectetuer adipiscing elit\.
315
- Aliquam hendrerit mi posuere lectus\. Vestibulum enim wisi,
316
- viverra nec, fringilla in, laoreet vitae, risus\.
317
- * Donec sit amet nisl\. Aliquam semper ipsum sit amet velit\.
318
- Suspendisse id sem consectetuer libero luctus adipiscing\.
319
- .fi
320
- .IP "" 0
321
- .P
322
- If list items are separated by blank lines, Markdown will wrap the items in \fB<p>\fR tags in the HTML output\. For example, this input:
323
- .IP "" 4
324
- .nf
325
- * Bird
326
- * Magic
327
- .fi
328
- .IP "" 0
329
- .P
330
- will turn into:
331
- .IP "" 4
332
- .nf
333
- <ul>
334
- <li>Bird</li>
335
- <li>Magic</li>
336
- </ul>
337
- .fi
338
- .IP "" 0
339
- .P
340
- But this:
341
- .IP "" 4
342
- .nf
343
- * Bird
344
-
345
- * Magic
346
- .fi
347
- .IP "" 0
348
- .P
349
- will turn into:
350
- .IP "" 4
351
- .nf
352
- <ul>
353
- <li><p>Bird</p></li>
354
- <li><p>Magic</p></li>
355
- </ul>
356
- .fi
357
- .IP "" 0
358
- .P
359
- List items may consist of multiple paragraphs\. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab:
360
- .IP "" 4
361
- .nf
362
- 1\. This is a list item with two paragraphs\. Lorem ipsum dolor
363
- sit amet, consectetuer adipiscing elit\. Aliquam hendrerit
364
- mi posuere lectus\.
365
-
366
- Vestibulum enim wisi, viverra nec, fringilla in, laoreet
367
- vitae, risus\. Donec sit amet nisl\. Aliquam semper ipsum
368
- sit amet velit\.
369
-
370
- 2\. Suspendisse id sem consectetuer libero luctus adipiscing\.
371
- .fi
372
- .IP "" 0
373
- .P
374
- It looks nice if you indent every line of the subsequent paragraphs, but here again, Markdown will allow you to be lazy:
375
- .IP "" 4
376
- .nf
377
- * This is a list item with two paragraphs\.
378
-
379
- This is the second paragraph in the list item\. You're
380
- only required to indent the first line\. Lorem ipsum dolor
381
- sit amet, consectetuer adipiscing elit\.
382
-
383
- * Another item in the same list\.
384
- .fi
385
- .IP "" 0
386
- .P
387
- To put a blockquote within a list item, the blockquote's \fB>\fR delimiters need to be indented:
388
- .IP "" 4
389
- .nf
390
- * A list item with a blockquote:
391
-
392
- > This is a blockquote
393
- > inside a list item\.
394
- .fi
395
- .IP "" 0
396
- .P
397
- To put a code block within a list item, the code block needs to be indented \fItwice\fR \-\- 8 spaces or two tabs:
398
- .IP "" 4
399
- .nf
400
- * A list item with a code block:
401
-
402
- <code goes here>
403
- .fi
404
- .IP "" 0
405
- .P
406
- It's worth noting that it's possible to trigger an ordered list by accident, by writing something like this:
407
- .IP "" 4
408
- .nf
409
- 1986\. What a great season\.
410
- .fi
411
- .IP "" 0
412
- .P
413
- In other words, a \fInumber\-period\-space\fR sequence at the beginning of a line\. To avoid this, you can backslash\-escape the period:
414
- .IP "" 4
415
- .nf
416
- 1986\e\. What a great season\.
417
- .fi
418
- .IP "" 0
419
- .SS "Code Blocks"
420
- Pre\-formatted code blocks are used for writing about programming or markup source code\. Rather than forming normal paragraphs, the lines of a code block are interpreted literally\. Markdown wraps a code block in both \fB<pre>\fR and \fB<code>\fR tags\.
421
- .P
422
- To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab\. For example, given this input:
423
- .IP "" 4
424
- .nf
425
- This is a normal paragraph:
426
-
427
- This is a code block\.
428
- .fi
429
- .IP "" 0
430
- .P
431
- Markdown will generate:
432
- .IP "" 4
433
- .nf
434
- <p>This is a normal paragraph:</p>
435
-
436
- <pre><code>This is a code block\.
437
- </code></pre>
438
- .fi
439
- .IP "" 0
440
- .P
441
- One level of indentation \-\- 4 spaces or 1 tab \-\- is removed from each line of the code block\. For example, this:
442
- .IP "" 4
443
- .nf
444
- Here is an example of AppleScript:
445
-
446
- tell application "Foo"
447
- beep
448
- end tell
449
- .fi
450
- .IP "" 0
451
- .P
452
- will turn into:
453
- .IP "" 4
454
- .nf
455
- <p>Here is an example of AppleScript:</p>
456
-
457
- <pre><code>tell application "Foo"
458
- beep
459
- end tell
460
- </code></pre>
461
- .fi
462
- .IP "" 0
463
- .P
464
- A code block continues until it reaches a line that is not indented (or the end of the article)\.
465
- .P
466
- Within a code block, ampersands (\fB&\fR) and angle brackets (\fB<\fR and \fB>\fR) are automatically converted into HTML entities\. This makes it very easy to include example HTML source code using Markdown \-\- just paste it and indent it, and Markdown will handle the hassle of encoding the ampersands and angle brackets\. For example, this:
467
- .IP "" 4
468
- .nf
469
- <div class="footer">
470
- &copy; 2004 Foo Corporation
471
- </div>
472
- .fi
473
- .IP "" 0
474
- .P
475
- will turn into:
476
- .IP "" 4
477
- .nf
478
- <pre><code>&lt;div class="footer"&gt;
479
- &amp;copy; 2004 Foo Corporation
480
- &lt;/div&gt;
481
- </code></pre>
482
- .fi
483
- .IP "" 0
484
- .P
485
- Regular Markdown syntax is not processed within code blocks\. E\.g\., asterisks are just literal asterisks within a code block\. This means it's also easy to use Markdown to write about Markdown's own syntax\.
486
- .SS "Horizontal Rules"
487
- You can produce a horizontal rule tag (\fB<hr />\fR) by placing three or more hyphens, asterisks, or underscores on a line by themselves\. If you wish, you may use spaces between the hyphens or asterisks\. Each of the following lines will produce a horizontal rule:
488
- .IP "" 4
489
- .nf
490
- * * *
491
-
492
- ***
493
-
494
- *****
495
-
496
- \- \- \-
497
-
498
- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
499
- .fi
500
- .IP "" 0
501
- .SH "SPAN ELEMENTS"
502
- .SS "Links"
503
- Markdown supports two style of links: \fIinline\fR and \fIreference\fR\.
504
- .P
505
- In both styles, the link text is delimited by [square brackets]\.
506
- .P
507
- To create an inline link, use a set of regular parentheses immediately after the link text's closing square bracket\. Inside the parentheses, put the URL where you want the link to point, along with an \fIoptional\fR title for the link, surrounded in quotes\. For example:
508
- .IP "" 4
509
- .nf
510
- This is [an example](http://example\.com/ "Title") inline link\.
511
-
512
- [This link](http://example\.net/) has no title attribute\.
513
- .fi
514
- .IP "" 0
515
- .P
516
- Will produce:
517
- .IP "" 4
518
- .nf
519
- <p>This is <a href="http://example\.com/" title="Title">
520
- an example</a> inline link\.</p>
521
-
522
- <p><a href="http://example\.net/">This link</a> has no
523
- title attribute\.</p>
524
- .fi
525
- .IP "" 0
526
- .P
527
- If you're referring to a local resource on the same server, you can use relative paths:
528
- .IP "" 4
529
- .nf
530
- See my [About](/about/) page for details\.
531
- .fi
532
- .IP "" 0
533
- .P
534
- Reference\-style links use a second set of square brackets, inside which you place a label of your choosing to identify the link:
535
- .IP "" 4
536
- .nf
537
- This is [an example][id] reference\-style link\.
538
- .fi
539
- .IP "" 0
540
- .P
541
- You can optionally use a space to separate the sets of brackets:
542
- .IP "" 4
543
- .nf
544
- This is [an example] [id] reference\-style link\.
545
- .fi
546
- .IP "" 0
547
- .P
548
- Then, anywhere in the document, you define your link label like this, on a line by itself:
549
- .IP "" 4
550
- .nf
551
- [id]: http://example\.com/ "Optional Title Here"
552
- .fi
553
- .IP "" 0
554
- .P
555
- That is:
556
- .IP "\(bu" 4
557
- Square brackets containing the link identifier (optionally indented from the left margin using up to three spaces);
558
- .IP "\(bu" 4
559
- followed by a colon;
560
- .IP "\(bu" 4
561
- followed by one or more spaces (or tabs);
562
- .IP "\(bu" 4
563
- followed by the URL for the link;
564
- .IP "\(bu" 4
565
- optionally followed by a title attribute for the link, enclosed in double or single quotes, or enclosed in parentheses\.
566
- .IP "" 0
567
- .P
568
- The following three link definitions are equivalent:
569
- .IP "" 4
570
- .nf
571
- [foo]: http://example\.com/ "Optional Title Here"
572
- [foo]: http://example\.com/ 'Optional Title Here'
573
- [foo]: http://example\.com/ (Optional Title Here)
574
- .fi
575
- .IP "" 0
576
- .P
577
- \fBNote:\fR There is a known bug in Markdown\.pl 1\.0\.1 which prevents single quotes from being used to delimit link titles\.
578
- .P
579
- The link URL may, optionally, be surrounded by angle brackets:
580
- .IP "" 4
581
- .nf
582
- [id]: <http://example\.com/> "Optional Title Here"
583
- .fi
584
- .IP "" 0
585
- .P
586
- You can put the title attribute on the next line and use extra spaces or tabs for padding, which tends to look better with longer URLs:
587
- .IP "" 4
588
- .nf
589
- [id]: http://example\.com/longish/path/to/resource/here
590
- "Optional Title Here"
591
- .fi
592
- .IP "" 0
593
- .P
594
- Link definitions are only used for creating links during Markdown processing, and are stripped from your document in the HTML output\.
595
- .P
596
- Link definition names may consist of letters, numbers, spaces, and punctuation \-\- but they are \fInot\fR case sensitive\. E\.g\. these two links:
597
- .IP "" 4
598
- .nf
599
- [link text][a]
600
- [link text][A]
601
- .fi
602
- .IP "" 0
603
- .P
604
- are equivalent\.
605
- .P
606
- The \fIimplicit link name\fR shortcut allows you to omit the name of the link, in which case the link text itself is used as the name\. Just use an empty set of square brackets \-\- e\.g\., to link the word "Google" to the google\.com web site, you could simply write:
607
- .IP "" 4
608
- .nf
609
- [Google][]
610
- .fi
611
- .IP "" 0
612
- .P
613
- And then define the link:
614
- .IP "" 4
615
- .nf
616
- [Google]: http://google\.com/
617
- .fi
618
- .IP "" 0
619
- .P
620
- Because link names may contain spaces, this shortcut even works for multiple words in the link text:
621
- .IP "" 4
622
- .nf
623
- Visit [Daring Fireball][] for more information\.
624
- .fi
625
- .IP "" 0
626
- .P
627
- And then define the link:
628
- .IP "" 4
629
- .nf
630
- [Daring Fireball]: http://daringfireball\.net/
631
- .fi
632
- .IP "" 0
633
- .P
634
- Link definitions can be placed anywhere in your Markdown document\. I tend to put them immediately after each paragraph in which they're used, but if you want, you can put them all at the end of your document, sort of like footnotes\.
635
- .P
636
- Here's an example of reference links in action:
637
- .IP "" 4
638
- .nf
639
- I get 10 times more traffic from [Google] [1] than from
640
- [Yahoo] [2] or [MSN] [3]\.
641
-
642
- [1]: http://google\.com/ "Google"
643
- [2]: http://search\.yahoo\.com/ "Yahoo Search"
644
- [3]: http://search\.msn\.com/ "MSN Search"
645
- .fi
646
- .IP "" 0
647
- .P
648
- Using the implicit link name shortcut, you could instead write:
649
- .IP "" 4
650
- .nf
651
- I get 10 times more traffic from [Google][] than from
652
- [Yahoo][] or [MSN][]\.
653
-
654
- [google]: http://google\.com/ "Google"
655
- [yahoo]: http://search\.yahoo\.com/ "Yahoo Search"
656
- [msn]: http://search\.msn\.com/ "MSN Search"
657
- .fi
658
- .IP "" 0
659
- .P
660
- Both of the above examples will produce the following HTML output:
661
- .IP "" 4
662
- .nf
663
- <p>I get 10 times more traffic from <a href="http://google\.com/"
664
- title="Google">Google</a> than from
665
- <a href="http://search\.yahoo\.com/" title="Yahoo Search">Yahoo</a>
666
- or <a href="http://search\.msn\.com/" title="MSN Search">MSN</a>\.</p>
667
- .fi
668
- .IP "" 0
669
- .P
670
- For comparison, here is the same paragraph written using Markdown's inline link style:
671
- .IP "" 4
672
- .nf
673
- I get 10 times more traffic from [Google](http://google\.com/ "Google")
674
- than from [Yahoo](http://search\.yahoo\.com/ "Yahoo Search") or
675
- [MSN](http://search\.msn\.com/ "MSN Search")\.
676
- .fi
677
- .IP "" 0
678
- .P
679
- The point of reference\-style links is not that they're easier to write\. The point is that with reference\-style links, your document source is vastly more readable\. Compare the above examples: using reference\-style links, the paragraph itself is only 81 characters long; with inline\-style links, it's 176 characters; and as raw HTML, it's 234 characters\. In the raw HTML, there's more markup than there is text\.
680
- .P
681
- With Markdown's reference\-style links, a source document much more closely resembles the final output, as rendered in a browser\. By allowing you to move the markup\-related metadata out of the paragraph, you can add links without interrupting the narrative flow of your prose\.
682
- .SS "Emphasis"
683
- Markdown treats asterisks (\fB*\fR) and underscores (\fB_\fR) as indicators of emphasis\. Text wrapped with one \fB*\fR or \fB_\fR will be wrapped with an HTML \fB<em>\fR tag; double \fB*\fR's or \fB_\fR's will be wrapped with an HTML \fB<strong>\fR tag\. E\.g\., this input:
684
- .IP "" 4
685
- .nf
686
- *single asterisks*
687
-
688
- _single underscores_
689
-
690
- **double asterisks**
691
-
692
- __double underscores__
693
- .fi
694
- .IP "" 0
695
- .P
696
- will produce:
697
- .IP "" 4
698
- .nf
699
- <em>single asterisks</em>
700
-
701
- <em>single underscores</em>
702
-
703
- <strong>double asterisks</strong>
704
-
705
- <strong>double underscores</strong>
706
- .fi
707
- .IP "" 0
708
- .P
709
- You can use whichever style you prefer; the lone restriction is that the same character must be used to open and close an emphasis span\.
710
- .P
711
- Emphasis can be used in the middle of a word:
712
- .IP "" 4
713
- .nf
714
- un*frigging*believable
715
- .fi
716
- .IP "" 0
717
- .P
718
- But if you surround an \fB*\fR or \fB_\fR with spaces, it'll be treated as a literal asterisk or underscore\.
719
- .P
720
- To produce a literal asterisk or underscore at a position where it would otherwise be used as an emphasis delimiter, you can backslash escape it:
721
- .IP "" 4
722
- .nf
723
- \e*this text is surrounded by literal asterisks\e*
724
- .fi
725
- .IP "" 0
726
- .SS "Code"
727
- To indicate a span of code, wrap it with backtick quotes (\fB`\fR)\. Unlike a pre\-formatted code block, a code span indicates code within a normal paragraph\. For example:
728
- .IP "" 4
729
- .nf
730
- Use the `printf()` function\.
731
- .fi
732
- .IP "" 0
733
- .P
734
- will produce:
735
- .IP "" 4
736
- .nf
737
- <p>Use the <code>printf()</code> function\.</p>
738
- .fi
739
- .IP "" 0
740
- .P
741
- To include a literal backtick character within a code span, you can use multiple backticks as the opening and closing delimiters:
742
- .IP "" 4
743
- .nf
744
- ``There is a literal backtick (`) here\.``
745
- .fi
746
- .IP "" 0
747
- .P
748
- which will produce this:
749
- .IP "" 4
750
- .nf
751
- <p><code>There is a literal backtick (`) here\.</code></p>
752
- .fi
753
- .IP "" 0
754
- .P
755
- The backtick delimiters surrounding a code span may include spaces \-\- one after the opening, one before the closing\. This allows you to place literal backtick characters at the beginning or end of a code span:
756
- .IP "" 4
757
- .nf
758
- A single backtick in a code span: `` ` ``
759
-
760
- A backtick\-delimited string in a code span: `` `foo` ``
761
- .fi
762
- .IP "" 0
763
- .P
764
- will produce:
765
- .IP "" 4
766
- .nf
767
- <p>A single backtick in a code span: <code>`</code></p>
768
-
769
- <p>A backtick\-delimited string in a code span: <code>`foo`</code></p>
770
- .fi
771
- .IP "" 0
772
- .P
773
- With a code span, ampersands and angle brackets are encoded as HTML entities automatically, which makes it easy to include example HTML tags\. Markdown will turn this:
774
- .IP "" 4
775
- .nf
776
- Please don't use any `<blink>` tags\.
777
- .fi
778
- .IP "" 0
779
- .P
780
- into:
781
- .IP "" 4
782
- .nf
783
- <p>Please don't use any <code>&lt;blink&gt;</code> tags\.</p>
784
- .fi
785
- .IP "" 0
786
- .P
787
- You can write this:
788
- .IP "" 4
789
- .nf
790
- `&#8212;` is the decimal\-encoded equivalent of `&mdash;`\.
791
- .fi
792
- .IP "" 0
793
- .P
794
- to produce:
795
- .IP "" 4
796
- .nf
797
- <p><code>&amp;#8212;</code> is the decimal\-encoded
798
- equivalent of <code>&amp;mdash;</code>\.</p>
799
- .fi
800
- .IP "" 0
801
- .SS "Images"
802
- Admittedly, it's fairly difficult to devise a "natural" syntax for placing images into a plain text document format\.
803
- .P
804
- Markdown uses an image syntax that is intended to resemble the syntax for links, allowing for two styles: \fIinline\fR and \fIreference\fR\.
805
- .P
806
- Inline image syntax looks like this:
807
- .IP "" 4
808
- .nf
809
- ![Alt text](/path/to/img\.jpg)
810
-
811
- ![Alt text](/path/to/img\.jpg "Optional title")
812
- .fi
813
- .IP "" 0
814
- .P
815
- That is:
816
- .IP "\(bu" 4
817
- An exclamation mark: \fB!\fR;
818
- .IP "\(bu" 4
819
- followed by a set of square brackets, containing the \fBalt\fR attribute text for the image;
820
- .IP "\(bu" 4
821
- followed by a set of parentheses, containing the URL or path to the image, and an optional \fBtitle\fR attribute enclosed in double or single quotes\.
822
- .IP "" 0
823
- .P
824
- Reference\-style image syntax looks like this:
825
- .IP "" 4
826
- .nf
827
- ![Alt text][id]
828
- .fi
829
- .IP "" 0
830
- .P
831
- Where "id" is the name of a defined image reference\. Image references are defined using syntax identical to link references:
832
- .IP "" 4
833
- .nf
834
- [id]: url/to/image "Optional title attribute"
835
- .fi
836
- .IP "" 0
837
- .P
838
- As of this writing, Markdown has no syntax for specifying the dimensions of an image; if this is important to you, you can simply use regular HTML \fB<img>\fR tags\.
839
- .SH "MISCELLANEOUS"
840
- .SS "Automatic Links"
841
- Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets\. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
842
- .IP "" 4
843
- .nf
844
- <http://example\.com/>
845
- .fi
846
- .IP "" 0
847
- .P
848
- Markdown will turn this into:
849
- .IP "" 4
850
- .nf
851
- <a href="http://example\.com/">http://example\.com/</a>
852
- .fi
853
- .IP "" 0
854
- .P
855
- Automatic links for email addresses work similarly, except that Markdown will also perform a bit of randomized decimal and hex entity\-encoding to help obscure your address from address\-harvesting spambots\. For example, Markdown will turn this:
856
- .IP "" 4
857
- .nf
858
- <address@example\.com>
859
- .fi
860
- .IP "" 0
861
- .P
862
- into something like this:
863
- .IP "" 4
864
- .nf
865
- <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
866
- &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
867
- &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
868
- &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
869
- .fi
870
- .IP "" 0
871
- .P
872
- which will render in a browser as a clickable link to "address@example\.com"\.
873
- .P
874
- (This sort of entity\-encoding trick will indeed fool many, if not most, address\-harvesting bots, but it definitely won't fool all of them\. It's better than nothing, but an address published in this way will probably eventually start receiving spam\.)
875
- .SS "Backslash Escapes"
876
- Markdown allows you to use backslash escapes to generate literal characters which would otherwise have special meaning in Markdown's formatting syntax\. For example, if you wanted to surround a word with literal asterisks (instead of an HTML \fB<em>\fR tag), you can use backslashes before the asterisks, like this:
877
- .IP "" 4
878
- .nf
879
- \e*literal asterisks\e*
880
- .fi
881
- .IP "" 0
882
- .P
883
- Markdown provides backslash escapes for the following characters:
884
- .IP "" 4
885
- .nf
886
- \e backslash
887
- ` backtick
888
- * asterisk
889
- _ underscore
890
- {} curly braces
891
- [] square brackets
892
- () parentheses
893
- # hash mark
894
- + plus sign
895
- \- minus sign (hyphen)
896
- \&\. dot
897
- ! exclamation mark
898
- .fi
899
- .IP "" 0
900
- .SH "AUTHOR"
901
- Markdown was created by John Gruber\.
902
- .P
903
- Manual page by Ryan Tomayko\. It's pretty much a direct copy of the Markdown Syntax Reference \fIhttp://daringfireball\.net/projects/markdown/syntax\fR, also by John Gruber\.
904
- .SH "SEE ALSO"
905
- ronn(5)
906
- .br
907
- \fIhttp://daringfireball\.net/projects/markdown/\fR