all repos — NoPaste @ 29b774f090102303e43cf939b38ac2083e62d9f1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/markdown/index.html (view raw)

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