1 <h1>Markdown: Basics</h1>
2 <ul id="ProjectSubmenu">
3 <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
4 <li><a class="selected" title="Markdown Basics">Basics</a></li>
5 <li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
6 <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
7 <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
9 <h2>Getting the Gist of Markdown's Formatting Syntax</h2>
10 <p>This page offers a brief overview of what it's like to use Markdown.
11 The <a href="/projects/markdown/syntax" title="Markdown Syntax">syntax page</a> provides complete, detailed documentation for
12 every feature, but Markdown should be very easy to pick up simply by
13 looking at a few examples of it in action. The examples on this page
14 are written in a before/after style, showing example syntax and the
15 HTML output produced by Markdown.</p>
16 <p>It's also helpful to simply try Markdown out; the <a href="/projects/markdown/dingus" title="Markdown Dingus">Dingus</a> is a
17 web application that allows you type your own Markdown-formatted text
18 and translate it to XHTML.</p>
19 <p><strong>Note:</strong> This document is itself written using Markdown; you
20 can <a href="/projects/markdown/basics.text">see the source for it by adding '.text' to the URL</a>.</p>
21 <h2>Paragraphs, Headers, Blockquotes</h2>
22 <p>A paragraph is simply one or more consecutive lines of text, separated
23 by one or more blank lines. (A blank line is any line that looks like a
24 blank line -- a line containing nothing spaces or tabs is considered
25 blank.) Normal paragraphs should not be intended with spaces or tabs.</p>
26 <p>Markdown offers two styles of headers: <em>Setext</em> and <em>atx</em>.
27 Setext-style headers for <code><h1></code> and <code><h2></code> are created by
28 "underlining" with equal signs (<code>=</code>) and hyphens (<code>-</code>), respectively.
29 To create an atx-style header, you put 1-6 hash marks (<code>#</code>) at the
30 beginning of the line -- the number of hashes equals the resulting
31 HTML header level.</p>
32 <p>Blockquotes are indicated using email-style '<code>></code>' angle brackets.</p>
34 <pre><code>A First Level Header
40 Now is the time for all good men to come to
41 the aid of their country. This is just a
44 The quick brown fox jumped over the lazy
49 > This is a blockquote.
51 > This is the second paragraph in the blockquote.
53 > ## This is an H2 in a blockquote
56 <pre><code><h1>A First Level Header</h1>
58 <h2>A Second Level Header</h2>
60 <p>Now is the time for all good men to come to
61 the aid of their country. This is just a
62 regular paragraph.</p>
64 <p>The quick brown fox jumped over the lazy
67 <h3>Header 3</h3>
70 <p>This is a blockquote.</p>
72 <p>This is the second paragraph in the blockquote.</p>
74 <h2>This is an H2 in a blockquote</h2>
77 <h3>Phrase Emphasis</h3>
78 <p>Markdown uses asterisks and underscores to indicate spans of emphasis.</p>
80 <pre><code>Some of these words *are emphasized*.
81 Some of these words _are emphasized also_.
83 Use two asterisks for **strong emphasis**.
84 Or, if you prefer, __use two underscores instead__.
87 <pre><code><p>Some of these words <em>are emphasized</em>.
88 Some of these words <em>are emphasized also</em>.</p>
90 <p>Use two asterisks for <strong>strong emphasis</strong>.
91 Or, if you prefer, <strong>use two underscores instead</strong>.</p>
94 <p>Unordered (bulleted) lists use asterisks, pluses, and hyphens (<code>*</code>,
95 <code>+</code>, and <code>-</code>) as list markers. These three markers are
96 interchangable; this:</p>
111 <p>all produce the same output:</p>
112 <pre><code><ul>
113 <li>Candy.</li>
114 <li>Gum.</li>
115 <li>Booze.</li>
118 <p>Ordered (numbered) lists use regular numbers, followed by periods, as
125 <pre><code><ol>
126 <li>Red</li>
127 <li>Green</li>
128 <li>Blue</li>
131 <p>If you put blank lines between items, you'll get <code><p></code> tags for the
132 list item text. You can create multi-paragraph list items by indenting
133 the paragraphs by 4 spaces or 1 tab:</p>
134 <pre><code>* A list item.
136 With multiple paragraphs.
138 * Another item in the list.
141 <pre><code><ul>
142 <li><p>A list item.</p>
143 <p>With multiple paragraphs.</p></li>
144 <li><p>Another item in the list.</p></li>
149 <p>Markdown supports two styles for creating links: <em>inline</em> and
150 <em>reference</em>. With both styles, you use square brackets to delimit the
151 text you want to turn into a link.</p>
152 <p>Inline-style links use parentheses immediately after the link text.
154 <pre><code>This is an [example link](http://example.com/).
157 <pre><code><p>This is an <a href="http://example.com/">
158 example link</a>.</p>
160 <p>Optionally, you may include a title attribute in the parentheses:</p>
161 <pre><code>This is an [example link](http://example.com/ "With a Title").
164 <pre><code><p>This is an <a href="http://example.com/" title="With a Title">
165 example link</a>.</p>
167 <p>Reference-style links allow you to refer to your links by names, which
168 you define elsewhere in your document:</p>
169 <pre><code>I get 10 times more traffic from [Google][1] than from
170 [Yahoo][2] or [MSN][3].
172 [1]: http://google.com/ "Google"
173 [2]: http://search.yahoo.com/ "Yahoo Search"
174 [3]: http://search.msn.com/ "MSN Search"
177 <pre><code><p>I get 10 times more traffic from <a href="http://google.com/"
178 title="Google">Google</a> than from <a href="http://search.yahoo.com/"
179 title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
180 title="MSN Search">MSN</a>.</p>
182 <p>The title attribute is optional. Link names may contain letters,
183 numbers and spaces, but are <em>not</em> case sensitive:</p>
184 <pre><code>I start my morning with a cup of coffee and
185 [The New York Times][NY Times].
187 [ny times]: http://www.nytimes.com/
190 <pre><code><p>I start my morning with a cup of coffee and
191 <a href="http://www.nytimes.com/">The New York Times</a>.</p>
194 <p>Image syntax is very much like link syntax.</p>
195 <p>Inline (titles are optional):</p>
196 <pre><code>![alt text](/path/to/img.jpg "Title")
198 <p>Reference-style:</p>
199 <pre><code>![alt text][id]
201 [id]: /path/to/img.jpg "Title"
203 <p>Both of the above examples produce the same output:</p>
204 <pre><code><img src="/path/to/img.jpg" alt="alt text" title="Title" />
207 <p>In a regular paragraph, you can create code span by wrapping text in
208 backtick quotes. Any ampersands (<code>&</code>) and angle brackets (<code><</code> or
209 <code>></code>) will automatically be translated into HTML entities. This makes
210 it easy to use Markdown to write about HTML example code:</p>
211 <pre><code>I strongly recommend against using any `<blink>` tags.
213 I wish SmartyPants used named entities like `&mdash;`
214 instead of decimal-encoded entites like `&#8212;`.
217 <pre><code><p>I strongly recommend against using any
218 <code>&lt;blink&gt;</code> tags.</p>
220 <p>I wish SmartyPants used named entities like
221 <code>&amp;mdash;</code> instead of decimal-encoded
222 entites like <code>&amp;#8212;</code>.</p>
224 <p>To specify an entire block of pre-formatted code, indent every line of
225 the block by 4 spaces or 1 tab. Just like with code spans, <code>&</code>, <code><</code>,
226 and <code>></code> characters will be escaped automatically.</p>
228 <pre><code>If you want your page to validate under XHTML 1.0 Strict,
229 you've got to put paragraph tags in your blockquotes:
232 <p>For example.</p>
236 <pre><code><p>If you want your page to validate under XHTML 1.0 Strict,
237 you've got to put paragraph tags in your blockquotes:</p>
239 <pre><code>&lt;blockquote&gt;
240 &lt;p&gt;For example.&lt;/p&gt;
241 &lt;/blockquote&gt;
242 </code></pre>