bb785b13fc9196f61e1ce8db90865eceeb7c47fa
[myslice.git] / third-party / codemirror-3.15 / mode / markdown / index.html
1 <!doctype html>
2 <html>
3   <head>
4     <meta charset="utf-8">
5     <title>CodeMirror: Markdown mode</title>
6     <link rel="stylesheet" href="../../lib/codemirror.css">
7     <script src="../../lib/codemirror.js"></script>
8     <script src="../../addon/edit/continuelist.js"></script>
9     <script src="../xml/xml.js"></script>
10     <script src="markdown.js"></script>
11     <style type="text/css">
12       .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
13       .cm-s-default .cm-trailing-space-a:before,
14       .cm-s-default .cm-trailing-space-b:before {position: absolute; content: "\00B7"; color: #777;}
15       .cm-s-default .cm-trailing-space-new-line:before {position: absolute; content: "\21B5"; color: #777;}
16     </style>
17     <link rel="stylesheet" href="../../doc/docs.css">
18   </head>
19   <body>
20     <h1>CodeMirror: Markdown mode</h1>
21
22 <!-- source: http://daringfireball.net/projects/markdown/basics.text -->
23 <form><textarea id="code" name="code">
24 Markdown: Basics
25 ================
26
27 &lt;ul id="ProjectSubmenu"&gt;
28     &lt;li&gt;&lt;a href="/projects/markdown/" title="Markdown Project Page"&gt;Main&lt;/a&gt;&lt;/li&gt;
29     &lt;li&gt;&lt;a class="selected" title="Markdown Basics"&gt;Basics&lt;/a&gt;&lt;/li&gt;
30     &lt;li&gt;&lt;a href="/projects/markdown/syntax" title="Markdown Syntax Documentation"&gt;Syntax&lt;/a&gt;&lt;/li&gt;
31     &lt;li&gt;&lt;a href="/projects/markdown/license" title="Pricing and License Information"&gt;License&lt;/a&gt;&lt;/li&gt;
32     &lt;li&gt;&lt;a href="/projects/markdown/dingus" title="Online Markdown Web Form"&gt;Dingus&lt;/a&gt;&lt;/li&gt;
33 &lt;/ul&gt;
34
35
36 Getting the Gist of Markdown's Formatting Syntax
37 ------------------------------------------------
38
39 This page offers a brief overview of what it's like to use Markdown.
40 The [syntax page] [s] provides complete, detailed documentation for
41 every feature, but Markdown should be very easy to pick up simply by
42 looking at a few examples of it in action. The examples on this page
43 are written in a before/after style, showing example syntax and the
44 HTML output produced by Markdown.
45
46 It's also helpful to simply try Markdown out; the [Dingus] [d] is a
47 web application that allows you type your own Markdown-formatted text
48 and translate it to XHTML.
49
50 **Note:** This document is itself written using Markdown; you
51 can [see the source for it by adding '.text' to the URL] [src].
52
53   [s]: /projects/markdown/syntax  "Markdown Syntax"
54   [d]: /projects/markdown/dingus  "Markdown Dingus"
55   [src]: /projects/markdown/basics.text
56
57
58 ## Paragraphs, Headers, Blockquotes ##
59
60 A paragraph is simply one or more consecutive lines of text, separated
61 by one or more blank lines. (A blank line is any line that looks like
62 a blank line -- a line containing nothing but spaces or tabs is
63 considered blank.) Normal paragraphs should not be indented with
64 spaces or tabs.
65
66 Markdown offers two styles of headers: *Setext* and *atx*.
67 Setext-style headers for `&lt;h1&gt;` and `&lt;h2&gt;` are created by
68 "underlining" with equal signs (`=`) and hyphens (`-`), respectively.
69 To create an atx-style header, you put 1-6 hash marks (`#`) at the
70 beginning of the line -- the number of hashes equals the resulting
71 HTML header level.
72
73 Blockquotes are indicated using email-style '`&gt;`' angle brackets.
74
75 Markdown:
76
77     A First Level Header
78     ====================
79     
80     A Second Level Header
81     ---------------------
82
83     Now is the time for all good men to come to
84     the aid of their country. This is just a
85     regular paragraph.
86
87     The quick brown fox jumped over the lazy
88     dog's back.
89     
90     ### Header 3
91
92     &gt; This is a blockquote.
93     &gt; 
94     &gt; This is the second paragraph in the blockquote.
95     &gt;
96     &gt; ## This is an H2 in a blockquote
97
98
99 Output:
100
101     &lt;h1&gt;A First Level Header&lt;/h1&gt;
102     
103     &lt;h2&gt;A Second Level Header&lt;/h2&gt;
104     
105     &lt;p&gt;Now is the time for all good men to come to
106     the aid of their country. This is just a
107     regular paragraph.&lt;/p&gt;
108     
109     &lt;p&gt;The quick brown fox jumped over the lazy
110     dog's back.&lt;/p&gt;
111     
112     &lt;h3&gt;Header 3&lt;/h3&gt;
113     
114     &lt;blockquote&gt;
115         &lt;p&gt;This is a blockquote.&lt;/p&gt;
116         
117         &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
118         
119         &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
120     &lt;/blockquote&gt;
121
122
123
124 ### Phrase Emphasis ###
125
126 Markdown uses asterisks and underscores to indicate spans of emphasis.
127
128 Markdown:
129
130     Some of these words *are emphasized*.
131     Some of these words _are emphasized also_.
132     
133     Use two asterisks for **strong emphasis**.
134     Or, if you prefer, __use two underscores instead__.
135
136 Output:
137
138     &lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
139     Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
140     
141     &lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
142     Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
143    
144
145
146 ## Lists ##
147
148 Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
149 `+`, and `-`) as list markers. These three markers are
150 interchangable; this:
151
152     *   Candy.
153     *   Gum.
154     *   Booze.
155
156 this:
157
158     +   Candy.
159     +   Gum.
160     +   Booze.
161
162 and this:
163
164     -   Candy.
165     -   Gum.
166     -   Booze.
167
168 all produce the same output:
169
170     &lt;ul&gt;
171     &lt;li&gt;Candy.&lt;/li&gt;
172     &lt;li&gt;Gum.&lt;/li&gt;
173     &lt;li&gt;Booze.&lt;/li&gt;
174     &lt;/ul&gt;
175
176 Ordered (numbered) lists use regular numbers, followed by periods, as
177 list markers:
178
179     1.  Red
180     2.  Green
181     3.  Blue
182
183 Output:
184
185     &lt;ol&gt;
186     &lt;li&gt;Red&lt;/li&gt;
187     &lt;li&gt;Green&lt;/li&gt;
188     &lt;li&gt;Blue&lt;/li&gt;
189     &lt;/ol&gt;
190
191 If you put blank lines between items, you'll get `&lt;p&gt;` tags for the
192 list item text. You can create multi-paragraph list items by indenting
193 the paragraphs by 4 spaces or 1 tab:
194
195     *   A list item.
196     
197         With multiple paragraphs.
198
199     *   Another item in the list.
200
201 Output:
202
203     &lt;ul&gt;
204     &lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
205     &lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
206     &lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
207     &lt;/ul&gt;
208     
209
210
211 ### Links ###
212
213 Markdown supports two styles for creating links: *inline* and
214 *reference*. With both styles, you use square brackets to delimit the
215 text you want to turn into a link.
216
217 Inline-style links use parentheses immediately after the link text.
218 For example:
219
220     This is an [example link](http://example.com/).
221
222 Output:
223
224     &lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
225     example link&lt;/a&gt;.&lt;/p&gt;
226
227 Optionally, you may include a title attribute in the parentheses:
228
229     This is an [example link](http://example.com/ "With a Title").
230
231 Output:
232
233     &lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
234     example link&lt;/a&gt;.&lt;/p&gt;
235
236 Reference-style links allow you to refer to your links by names, which
237 you define elsewhere in your document:
238
239     I get 10 times more traffic from [Google][1] than from
240     [Yahoo][2] or [MSN][3].
241
242     [1]: http://google.com/        "Google"
243     [2]: http://search.yahoo.com/  "Yahoo Search"
244     [3]: http://search.msn.com/    "MSN Search"
245
246 Output:
247
248     &lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
249     title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
250     title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
251     title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
252
253 The title attribute is optional. Link names may contain letters,
254 numbers and spaces, but are *not* case sensitive:
255
256     I start my morning with a cup of coffee and
257     [The New York Times][NY Times].
258
259     [ny times]: http://www.nytimes.com/
260
261 Output:
262
263     &lt;p&gt;I start my morning with a cup of coffee and
264     &lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
265
266
267 ### Images ###
268
269 Image syntax is very much like link syntax.
270
271 Inline (titles are optional):
272
273     ![alt text](/path/to/img.jpg "Title")
274
275 Reference-style:
276
277     ![alt text][id]
278
279     [id]: /path/to/img.jpg "Title"
280
281 Both of the above examples produce the same output:
282
283     &lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
284
285
286
287 ### Code ###
288
289 In a regular paragraph, you can create code span by wrapping text in
290 backtick quotes. Any ampersands (`&amp;`) and angle brackets (`&lt;` or
291 `&gt;`) will automatically be translated into HTML entities. This makes
292 it easy to use Markdown to write about HTML example code:
293
294     I strongly recommend against using any `&lt;blink&gt;` tags.
295
296     I wish SmartyPants used named entities like `&amp;mdash;`
297     instead of decimal-encoded entites like `&amp;#8212;`.
298
299 Output:
300
301     &lt;p&gt;I strongly recommend against using any
302     &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
303     
304     &lt;p&gt;I wish SmartyPants used named entities like
305     &lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
306     entites like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
307
308
309 To specify an entire block of pre-formatted code, indent every line of
310 the block by 4 spaces or 1 tab. Just like with code spans, `&amp;`, `&lt;`,
311 and `&gt;` characters will be escaped automatically.
312
313 Markdown:
314
315     If you want your page to validate under XHTML 1.0 Strict,
316     you've got to put paragraph tags in your blockquotes:
317
318         &lt;blockquote&gt;
319             &lt;p&gt;For example.&lt;/p&gt;
320         &lt;/blockquote&gt;
321
322 Output:
323
324     &lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
325     you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
326     
327     &lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
328         &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
329     &amp;lt;/blockquote&amp;gt;
330     &lt;/code&gt;&lt;/pre&gt;
331 </textarea></form>
332
333     <script>
334       var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
335         mode: 'markdown',
336         lineNumbers: true,
337         theme: "default",
338         extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
339       });
340     </script>
341
342     <p>Optionally depends on the XML mode for properly highlighted inline XML blocks.</p>
343
344     <p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
345
346     <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#markdown_*">normal</a>,  <a href="../../test/index.html#verbose,markdown_*">verbose</a>.</p>
347
348   </body>
349 </html>