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