root/HTTP/MarkdownSyntaxReference.txt

Revision 1236 (checked in by rsz, 7 months ago)

cleanup

Line 
1 ## Paragraphs, Headers, Blockquotes ##
2
3 A paragraph is simply one or more consecutive lines of text, separated
4 by one or more blank lines. (A blank line is any line that looks like
5 a blank line -- a line containing nothing but spaces or tabs is
6 considered blank.) Normal paragraphs should not be indented with
7 spaces or tabs.
8
9 Markdown offers two styles of headers: *Setext* and *atx*.
10 Setext-style headers for `<h1>` and `<h2>` are created by
11 "underlining" with equal signs (`=`) and hyphens (`-`), respectively.
12 To create an atx-style header, you put 1-6 hash marks (`#`) at the
13 beginning of the line -- the number of hashes equals the resulting
14 HTML header level.
15
16 Blockquotes are indicated using email-style '`>`' angle brackets.
17
18 Markdown:
19
20     A First Level Header
21     ====================
22    
23     A Second Level Header
24     ---------------------
25
26     Now is the time for all good men to come to
27     the aid of their country. This is just a
28     regular paragraph.
29
30     The quick brown fox jumped over the lazy
31     dog's back.
32    
33     ### Header 3
34
35     > This is a blockquote.
36     >
37     > This is the second paragraph in the blockquote.
38     >
39     > ## This is an H2 in a blockquote
40
41
42 Output:
43
44     <h1>A First Level Header</h1>
45    
46     <h2>A Second Level Header</h2>
47    
48     <p>Now is the time for all good men to come to
49     the aid of their country. This is just a
50     regular paragraph.</p>
51    
52     <p>The quick brown fox jumped over the lazy
53     dog's back.</p>
54    
55     <h3>Header 3</h3>
56    
57     <blockquote>
58         <p>This is a blockquote.</p>
59        
60         <p>This is the second paragraph in the blockquote.</p>
61        
62         <h2>This is an H2 in a blockquote</h2>
63     </blockquote>
64
65
66
67 ### Phrase Emphasis ###
68
69 Markdown uses asterisks and underscores to indicate spans of emphasis.
70
71 Markdown:
72
73     Some of these words *are emphasized*.
74     Some of these words _are emphasized also_.
75    
76     Use two asterisks for **strong emphasis**.
77     Or, if you prefer, __use two underscores instead__.
78
79 Output:
80
81     <p>Some of these words <em>are emphasized</em>.
82     Some of these words <em>are emphasized also</em>.</p>
83    
84     <p>Use two asterisks for <strong>strong emphasis</strong>.
85     Or, if you prefer, <strong>use two underscores instead</strong>.</p>
86    
87
88
89 ## Lists ##
90
91 Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
92 `+`, and `-`) as list markers. These three markers are
93 interchangable; this:
94
95     *   Candy.
96     *   Gum.
97     *   Booze.
98
99 this:
100
101     +   Candy.
102     +   Gum.
103     +   Booze.
104
105 and this:
106
107     -   Candy.
108     -   Gum.
109     -   Booze.
110
111 all produce the same output:
112
113     <ul>
114     <li>Candy.</li>
115     <li>Gum.</li>
116     <li>Booze.</li>
117     </ul>
118
119 Ordered (numbered) lists use regular numbers, followed by periods, as
120 list markers:
121
122     1.  Red
123     2.  Green
124     3.  Blue
125
126 Output:
127
128     <ol>
129     <li>Red</li>
130     <li>Green</li>
131     <li>Blue</li>
132     </ol>
133
134 If you put blank lines between items, you'll get `<p>` tags for the
135 list item text. You can create multi-paragraph list items by indenting
136 the paragraphs by 4 spaces or 1 tab:
137
138     *   A list item.
139    
140         With multiple paragraphs.
141
142     *   Another item in the list.
143
144 Output:
145
146     <ul>
147     <li><p>A list item.</p>
148     <p>With multiple paragraphs.</p></li>
149     <li><p>Another item in the list.</p></li>
150     </ul>
151    
152
153
154 ### Links ###
155
156 Markdown supports two styles for creating links: *inline* and
157 *reference*. With both styles, you use square brackets to delimit the
158 text you want to turn into a link.
159
160 Inline-style links use parentheses immediately after the link text.
161 For example:
162
163     This is an [example link](http://example.com/).
164
165 Output:
166
167     <p>This is an <a href="http://example.com/">
168     example link</a>.</p>
169
170 Optionally, you may include a title attribute in the parentheses:
171
172     This is an [example link](http://example.com/ "With a Title").
173
174 Output:
175
176     <p>This is an <a href="http://example.com/" title="With a Title">
177     example link</a>.</p>
178
179 Reference-style links allow you to refer to your links by names, which
180 you define elsewhere in your document:
181
182     I get 10 times more traffic from [Google][1] than from
183     [Yahoo][2] or [MSN][3].
184
185     [1]: http://google.com/        "Google"
186     [2]: http://search.yahoo.com/  "Yahoo Search"
187     [3]: http://search.msn.com/    "MSN Search"
188
189 Output:
190
191     <p>I get 10 times more traffic from <a href="http://google.com/"
192     title="Google">Google</a> than from <a href="http://search.yahoo.com/"
193     title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
194     title="MSN Search">MSN</a>.</p>
195
196 The title attribute is optional. Link names may contain letters,
197 numbers and spaces, but are *not* case sensitive:
198
199     I start my morning with a cup of coffee and
200     [The New York Times][NY Times].
201
202     [ny times]: http://www.nytimes.com/
203
204 Output:
205
206     <p>I start my morning with a cup of coffee and
207     <a href="http://www.nytimes.com/">The New York Times</a>.</p>
208
209
210 ### Images ###
211
212 Image syntax is very much like link syntax.
213
214 Inline (titles are optional):
215
216     ![alt text](/path/to/img.jpg "Title")
217
218 Reference-style:
219
220     ![alt text][id]
221
222     [id]: /path/to/img.jpg "Title"
223
224 Both of the above examples produce the same output:
225
226     <img src="/path/to/img.jpg" alt="alt text" title="Title" />
227
228
229
230 ### Code ###
231
232 In a regular paragraph, you can create code span by wrapping text in
233 backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
234 `>`) will automatically be translated into HTML entities. This makes
235 it easy to use Markdown to write about HTML example code:
236
237     I strongly recommend against using any `<blink>` tags.
238
239     I wish SmartyPants used named entities like `&mdash;`
240     instead of decimal-encoded entites like `&#8212;`.
241
242 Output:
243
244     <p>I strongly recommend against using any
245     <code>&lt;blink&gt;</code> tags.</p>
246    
247     <p>I wish SmartyPants used named entities like
248     <code>&amp;mdash;</code> instead of decimal-encoded
249     entites like <code>&amp;#8212;</code>.</p>
250
251
252 To specify an entire block of pre-formatted code, indent every line of
253 the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
254 and `>` characters will be escaped automatically.
Note: See TracBrowser for help on using the browser.