2
0

index.html 10 KB

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