5ada258ccaed9e416f7d6e77f5ef15f2fcd32faf
[kengrimes.com/content.git] / content / post / testmd.md
1 ---
2 title: Markdown Test
3 caption: This Markdown is Tested!
4 ---
5 Markdown: Syntax
6 ================
7
8 <ul id="ProjectSubmenu">
9 <li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
10 <li><a href="/projects/markdown/basics" title="Markdown Basics">Basics</a></li>
11 <li><a class="selected" title="Markdown Syntax Documentation">Syntax</a></li>
12 <li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
13 <li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
14 </ul>
15
16
17 * [Overview](#overview)
18 * [Philosophy](#philosophy)
19 * [Inline HTML](#html)
20 * [Automatic Escaping for Special Characters](#autoescape)
21 * [Block Elements](#block)
22 * [Paragraphs and Line Breaks](#p)
23 * [Headers](#header)
24 * [Blockquotes](#blockquote)
25 * [Lists](#list)
26 * [Code Blocks](#precode)
27 * [Horizontal Rules](#hr)
28 * [Span Elements](#span)
29 * [Links](#link)
30 * [Emphasis](#em)
31 * [Code](#code)
32 * [Images](#img)
33 * [Miscellaneous](#misc)
34 * [Backslash Escapes](#backslash)
35 * [Automatic Links](#autolink)
36
37
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
41 [src]: /projects/markdown/syntax.text
42
43 * * *
44
45 <h2 id="overview">Overview</h2>
46
47 <h3 id="philosophy">Philosophy</h3>
48
49 Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
50
51 Readability, however, is emphasized above all else. A Markdown-formatted
52 document should be publishable as-is, as plain text, without looking
53 like it's been marked up with tags or formatting instructions. While
54 Markdown's syntax has been influenced by several existing text-to-HTML
55 filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
56 [Grutatext] [5], and [EtText] [6] -- the single biggest source of
57 inspiration for Markdown's syntax is the format of plain text email.
58
59 [1]: http://docutils.sourceforge.net/mirror/setext.html
60 [2]: http://www.aaronsw.com/2002/atx/
61 [3]: http://textism.com/tools/textile/
62 [4]: http://docutils.sourceforge.net/rst.html
63 [5]: http://www.triptico.com/software/grutatxt.html
64 [6]: http://ettext.taint.org/doc/
65
66 To this end, Markdown's syntax is comprised entirely of punctuation
67 characters, which punctuation characters have been carefully chosen so
68 as to look like what they mean. E.g., asterisks around a word actually
69 look like \*emphasis\*. Markdown lists look like, well, lists. Even
70 blockquotes look like quoted passages of text, assuming you've ever
71 used email.
72
73
74
75 <h3 id="html">Inline HTML</h3>
76
77 Markdown's syntax is intended for one purpose: to be used as a
78 format for *writing* for the web.
79
80 Markdown is not a replacement for HTML, or even close to it. Its
81 syntax is very small, corresponding only to a very small subset of
82 HTML tags. The idea is *not* to create a syntax that makes it easier
83 to insert HTML tags. In my opinion, HTML tags are already easy to
84 insert. The idea for Markdown is to make it easy to read, write, and
85 edit prose. HTML is a *publishing* format; Markdown is a *writing*
86 format. Thus, Markdown's formatting syntax only addresses issues that
87 can be conveyed in plain text.
88
89 For any markup that is not covered by Markdown's syntax, you simply
90 use HTML itself. There's no need to preface it or delimit it to
91 indicate that you're switching from Markdown to HTML; you just use
92 the tags.
93
94 The only restrictions are that block-level HTML elements -- e.g. `<div>`,
95 `<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
96 content by blank lines, and the start and end tags of the block should
97 not be indented with tabs or spaces. Markdown is smart enough not
98 to add extra (unwanted) `<p>` tags around HTML block-level tags.
99
100 For example, to add an HTML table to a Markdown article:
101
102 This is a regular paragraph.
103
104 <table>
105 <tr>
106 <td>Foo</td>
107 </tr>
108 </table>
109
110 This is another regular paragraph.
111
112 Note that Markdown formatting syntax is not processed within block-level
113 HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
114 HTML block.
115
116 Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
117 used anywhere in a Markdown paragraph, list item, or header. If you
118 want, you can even use HTML tags instead of Markdown formatting; e.g. if
119 you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
120 link or image syntax, go right ahead.
121
122 Unlike block-level HTML tags, Markdown syntax *is* processed within
123 span-level tags.
124
125
126 <h3 id="autoescape">Automatic Escaping for Special Characters</h3>
127
128 In HTML, there are two characters that demand special treatment: `<`
129 and `&`. Left angle brackets are used to start tags; ampersands are
130 used to denote HTML entities. If you want to use them as literal
131 characters, you must escape them as entities, e.g. `&lt;`, and
132 `&amp;`.
133
134 Ampersands in particular are bedeviling for web writers. If you want to
135 write about 'AT&T', you need to write '`AT&amp;T`'. You even need to
136 escape ampersands within URLs. Thus, if you want to link to:
137
138 http://images.google.com/images?num=30&q=larry+bird
139
140 you need to encode the URL as:
141
142 http://images.google.com/images?num=30&amp;q=larry+bird
143
144 in your anchor tag `href` attribute. Needless to say, this is easy to
145 forget, and is probably the single most common source of HTML validation
146 errors in otherwise well-marked-up web sites.
147
148 Markdown allows you to use these characters naturally, taking care of
149 all the necessary escaping for you. If you use an ampersand as part of
150 an HTML entity, it remains unchanged; otherwise it will be translated
151 into `&amp;`.
152
153 So, if you want to include a copyright symbol in your article, you can write:
154
155 &copy;
156
157 and Markdown will leave it alone. But if you write:
158
159 AT&T
160
161 Markdown will translate it to:
162
163 AT&amp;T
164
165 Similarly, because Markdown supports [inline HTML](#html), if you use
166 angle brackets as delimiters for HTML tags, Markdown will treat them as
167 such. But if you write:
168
169 4 < 5
170
171 Markdown will translate it to:
172
173 4 &lt; 5
174
175 However, inside Markdown code spans and blocks, angle brackets and
176 ampersands are *always* encoded automatically. This makes it easy to use
177 Markdown to write about HTML code. (As opposed to raw HTML, which is a
178 terrible format for writing about HTML syntax, because every single `<`
179 and `&` in your example code needs to be escaped.)
180
181
182 * * *
183
184
185 <h2 id="block">Block Elements</h2>
186
187
188 <h3 id="p">Paragraphs and Line Breaks</h3>
189
190 A paragraph is simply one or more consecutive lines of text, separated
191 by one or more blank lines. (A blank line is any line that looks like a
192 blank line -- a line containing nothing but spaces or tabs is considered
193 blank.) Normal paragraphs should not be intended with spaces or tabs.
194
195 The implication of the "one or more consecutive lines of text" rule is
196 that Markdown supports "hard-wrapped" text paragraphs. This differs
197 significantly from most other text-to-HTML formatters (including Movable
198 Type's "Convert Line Breaks" option) which translate every line break
199 character in a paragraph into a `<br />` tag.
200
201 When you *do* want to insert a `<br />` break tag using Markdown, you
202 end a line with two or more spaces, then type return.
203
204 Yes, this takes a tad more effort to create a `<br />`, but a simplistic
205 "every line break is a `<br />`" rule wouldn't work for Markdown.
206 Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
207 work best -- and look better -- when you format them with hard breaks.
208
209 [bq]: #blockquote
210 [l]: #list
211
212
213
214 <h3 id="header">Headers</h3>
215
216 Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
217
218 Setext-style headers are "underlined" using equal signs (for first-level
219 headers) and dashes (for second-level headers). For example:
220
221 This is an H1
222 =============
223
224 This is an H2
225 -------------
226
227 Any number of underlining `=`'s or `-`'s will work.
228
229 Atx-style headers use 1-6 hash characters at the start of the line,
230 corresponding to header levels 1-6. For example:
231
232 # This is an H1
233
234 ## This is an H2
235
236 ###### This is an H6
237
238 Optionally, you may "close" atx-style headers. This is purely
239 cosmetic -- you can use this if you think it looks better. The
240 closing hashes don't even need to match the number of hashes
241 used to open the header. (The number of opening hashes
242 determines the header level.) :
243
244 # This is an H1 #
245
246 ## This is an H2 ##
247
248 ### This is an H3 ######
249
250
251 <h3 id="blockquote">Blockquotes</h3>
252
253 Markdown uses email-style `>` characters for blockquoting. If you're
254 familiar with quoting passages of text in an email message, then you
255 know how to create a blockquote in Markdown. It looks best if you hard
256 wrap the text and put a `>` before every line:
257
258 > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
259 > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
260 > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
261 >
262 > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
263 > id sem consectetuer libero luctus adipiscing.
264
265 Markdown allows you to be lazy and only put the `>` before the first
266 line of a hard-wrapped paragraph:
267
268 > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
269 consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
270 Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
271
272 > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
273 id sem consectetuer libero luctus adipiscing.
274
275 Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
276 adding additional levels of `>`:
277
278 > This is the first level of quoting.
279 >
280 > > This is nested blockquote.
281 >
282 > Back to the first level.
283
284 Blockquotes can contain other Markdown elements, including headers, lists,
285 and code blocks:
286
287 > ## This is a header.
288 >
289 > 1. This is the first list item.
290 > 2. This is the second list item.
291 >
292 > Here's some example code:
293 >
294 > return shell_exec("echo $input | $markdown_script");
295
296 Any decent text editor should make email-style quoting easy. For
297 example, with BBEdit, you can make a selection and choose Increase
298 Quote Level from the Text menu.
299
300
301 <h3 id="list">Lists</h3>
302
303 Markdown supports ordered (numbered) and unordered (bulleted) lists.
304
305 Unordered lists use asterisks, pluses, and hyphens -- interchangably
306 -- as list markers:
307
308 * Red
309 * Green
310 * Blue
311
312 is equivalent to:
313
314 + Red
315 + Green
316 + Blue
317
318 and:
319
320 - Red
321 - Green
322 - Blue
323
324 Ordered lists use numbers followed by periods:
325
326 1. Bird
327 2. McHale
328 3. Parish
329
330 It's important to note that the actual numbers you use to mark the
331 list have no effect on the HTML output Markdown produces. The HTML
332 Markdown produces from the above list is:
333
334 <ol>
335 <li>Bird</li>
336 <li>McHale</li>
337 <li>Parish</li>
338 </ol>
339
340 If you instead wrote the list in Markdown like this:
341
342 1. Bird
343 1. McHale
344 1. Parish
345
346 or even:
347
348 3. Bird
349 1. McHale
350 8. Parish
351
352 you'd get the exact same HTML output. The point is, if you want to,
353 you can use ordinal numbers in your ordered Markdown lists, so that
354 the numbers in your source match the numbers in your published HTML.
355 But if you want to be lazy, you don't have to.
356
357 If you do use lazy list numbering, however, you should still start the
358 list with the number 1. At some point in the future, Markdown may support
359 starting ordered lists at an arbitrary number.
360
361 List markers typically start at the left margin, but may be indented by
362 up to three spaces. List markers must be followed by one or more spaces
363 or a tab.
364
365 To make lists look nice, you can wrap items with hanging indents:
366
367 * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
368 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
369 viverra nec, fringilla in, laoreet vitae, risus.
370 * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
371 Suspendisse id sem consectetuer libero luctus adipiscing.
372
373 But if you want to be lazy, you don't have to:
374
375 * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
376 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
377 viverra nec, fringilla in, laoreet vitae, risus.
378 * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
379 Suspendisse id sem consectetuer libero luctus adipiscing.
380
381 If list items are separated by blank lines, Markdown will wrap the
382 items in `<p>` tags in the HTML output. For example, this input:
383
384 * Bird
385 * Magic
386
387 will turn into:
388
389 <ul>
390 <li>Bird</li>
391 <li>Magic</li>
392 </ul>
393
394 But this:
395
396 * Bird
397
398 * Magic
399
400 will turn into:
401
402 <ul>
403 <li><p>Bird</p></li>
404 <li><p>Magic</p></li>
405 </ul>
406
407 List items may consist of multiple paragraphs. Each subsequent
408 paragraph in a list item must be intended by either 4 spaces
409 or one tab:
410
411 1. This is a list item with two paragraphs. Lorem ipsum dolor
412 sit amet, consectetuer adipiscing elit. Aliquam hendrerit
413 mi posuere lectus.
414
415 Vestibulum enim wisi, viverra nec, fringilla in, laoreet
416 vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
417 sit amet velit.
418
419 2. Suspendisse id sem consectetuer libero luctus adipiscing.
420
421 It looks nice if you indent every line of the subsequent
422 paragraphs, but here again, Markdown will allow you to be
423 lazy:
424
425 * This is a list item with two paragraphs.
426
427 This is the second paragraph in the list item. You're
428 only required to indent the first line. Lorem ipsum dolor
429 sit amet, consectetuer adipiscing elit.
430
431 * Another item in the same list.
432
433 To put a blockquote within a list item, the blockquote's `>`
434 delimiters need to be indented:
435
436 * A list item with a blockquote:
437
438 > This is a blockquote
439 > inside a list item.
440
441 To put a code block within a list item, the code block needs
442 to be indented *twice* -- 8 spaces or two tabs:
443
444 * A list item with a code block:
445
446 <code goes here>
447
448
449 It's worth noting that it's possible to trigger an ordered list by
450 accident, by writing something like this:
451
452 1986. What a great season.
453
454 In other words, a *number-period-space* sequence at the beginning of a
455 line. To avoid this, you can backslash-escape the period:
456
457 1986\. What a great season.
458
459
460
461 <h3 id="precode">Code Blocks</h3>
462
463 Pre-formatted code blocks are used for writing about programming or
464 markup source code. Rather than forming normal paragraphs, the lines
465 of a code block are interpreted literally. Markdown wraps a code block
466 in both `<pre>` and `<code>` tags.
467
468 To produce a code block in Markdown, simply indent every line of the
469 block by at least 4 spaces or 1 tab. For example, given this input:
470
471 This is a normal paragraph:
472
473 This is a code block.
474
475 Markdown will generate:
476
477 <p>This is a normal paragraph:</p>
478
479 <pre><code>This is a code block.
480 </code></pre>
481
482 One level of indentation -- 4 spaces or 1 tab -- is removed from each
483 line of the code block. For example, this:
484
485 Here is an example of AppleScript:
486
487 tell application "Foo"
488 beep
489 end tell
490
491 will turn into:
492
493 <p>Here is an example of AppleScript:</p>
494
495 <pre><code>tell application "Foo"
496 beep
497 end tell
498 </code></pre>
499
500 A code block continues until it reaches a line that is not indented
501 (or the end of the article).
502
503 Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
504 are automatically converted into HTML entities. This makes it very
505 easy to include example HTML source code using Markdown -- just paste
506 it and indent it, and Markdown will handle the hassle of encoding the
507 ampersands and angle brackets. For example, this:
508
509 <div class="footer">
510 &copy; 2004 Foo Corporation
511 </div>
512
513 will turn into:
514
515 <pre><code>&lt;div class="footer"&gt;
516 &amp;copy; 2004 Foo Corporation
517 &lt;/div&gt;
518 </code></pre>
519
520 Regular Markdown syntax is not processed within code blocks. E.g.,
521 asterisks are just literal asterisks within a code block. This means
522 it's also easy to use Markdown to write about Markdown's own syntax.
523
524
525
526 <h3 id="hr">Horizontal Rules</h3>
527
528 You can produce a horizontal rule tag (`<hr />`) by placing three or
529 more hyphens, asterisks, or underscores on a line by themselves. If you
530 wish, you may use spaces between the hyphens or asterisks. Each of the
531 following lines will produce a horizontal rule:
532
533 * * *
534
535 ***
536
537 *****
538
539 - - -
540
541 ---------------------------------------
542
543 _ _ _
544
545
546 * * *
547
548 <h2 id="span">Span Elements</h2>
549
550 <h3 id="link">Links</h3>
551
552 Markdown supports two style of links: *inline* and *reference*.
553
554 In both styles, the link text is delimited by [square brackets].
555
556 To create an inline link, use a set of regular parentheses immediately
557 after the link text's closing square bracket. Inside the parentheses,
558 put the URL where you want the link to point, along with an *optional*
559 title for the link, surrounded in quotes. For example:
560
561 This is [an example](http://example.com/ "Title") inline link.
562
563 [This link](http://example.net/) has no title attribute.
564
565 Will produce:
566
567 <p>This is <a href="http://example.com/" title="Title">
568 an example</a> inline link.</p>
569
570 <p><a href="http://example.net/">This link</a> has no
571 title attribute.</p>
572
573 If you're referring to a local resource on the same server, you can
574 use relative paths:
575
576 See my [About](/about/) page for details.
577
578 Reference-style links use a second set of square brackets, inside
579 which you place a label of your choosing to identify the link:
580
581 This is [an example][id] reference-style link.
582
583 You can optionally use a space to separate the sets of brackets:
584
585 This is [an example] [id] reference-style link.
586
587 Then, anywhere in the document, you define your link label like this,
588 on a line by itself:
589
590 [id]: http://example.com/ "Optional Title Here"
591
592 That is:
593
594 * Square brackets containing the link identifier (optionally
595 indented from the left margin using up to three spaces);
596 * followed by a colon;
597 * followed by one or more spaces (or tabs);
598 * followed by the URL for the link;
599 * optionally followed by a title attribute for the link, enclosed
600 in double or single quotes.
601
602 The link URL may, optionally, be surrounded by angle brackets:
603
604 [id]: <http://example.com/> "Optional Title Here"
605
606 You can put the title attribute on the next line and use extra spaces
607 or tabs for padding, which tends to look better with longer URLs:
608
609 [id]: http://example.com/longish/path/to/resource/here
610 "Optional Title Here"
611
612 Link definitions are only used for creating links during Markdown
613 processing, and are stripped from your document in the HTML output.
614
615 Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links:
616
617 [link text][a]
618 [link text][A]
619
620 are equivalent.
621
622 The *implicit link name* shortcut allows you to omit the name of the
623 link, in which case the link text itself is used as the name.
624 Just use an empty set of square brackets -- e.g., to link the word
625 "Google" to the google.com web site, you could simply write:
626
627 [Google][]
628
629 And then define the link:
630
631 [Google]: http://google.com/
632
633 Because link names may contain spaces, this shortcut even works for
634 multiple words in the link text:
635
636 Visit [Daring Fireball][] for more information.
637
638 And then define the link:
639
640 [Daring Fireball]: http://daringfireball.net/
641
642 Link definitions can be placed anywhere in your Markdown document. I
643 tend to put them immediately after each paragraph in which they're
644 used, but if you want, you can put them all at the end of your
645 document, sort of like footnotes.
646
647 Here's an example of reference links in action:
648
649 I get 10 times more traffic from [Google] [1] than from
650 [Yahoo] [2] or [MSN] [3].
651
652 [1]: http://google.com/ "Google"
653 [2]: http://search.yahoo.com/ "Yahoo Search"
654 [3]: http://search.msn.com/ "MSN Search"
655
656 Using the implicit link name shortcut, you could instead write:
657
658 I get 10 times more traffic from [Google][] than from
659 [Yahoo][] or [MSN][].
660
661 [google]: http://google.com/ "Google"
662 [yahoo]: http://search.yahoo.com/ "Yahoo Search"
663 [msn]: http://search.msn.com/ "MSN Search"
664
665 Both of the above examples will produce the following HTML output:
666
667 <p>I get 10 times more traffic from <a href="http://google.com/"
668 title="Google">Google</a> than from
669 <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
670 or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
671
672 For comparison, here is the same paragraph written using
673 Markdown's inline link style:
674
675 I get 10 times more traffic from [Google](http://google.com/ "Google")
676 than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
677 [MSN](http://search.msn.com/ "MSN Search").
678
679 The point of reference-style links is not that they're easier to
680 write. The point is that with reference-style links, your document
681 source is vastly more readable. Compare the above examples: using
682 reference-style links, the paragraph itself is only 81 characters
683 long; with inline-style links, it's 176 characters; and as raw HTML,
684 it's 234 characters. In the raw HTML, there's more markup than there
685 is text.
686
687 With Markdown's reference-style links, a source document much more
688 closely resembles the final output, as rendered in a browser. By
689 allowing you to move the markup-related metadata out of the paragraph,
690 you can add links without interrupting the narrative flow of your
691 prose.
692
693
694 <h3 id="em">Emphasis</h3>
695
696 Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
697 emphasis. Text wrapped with one `*` or `_` will be wrapped with an
698 HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
699 `<strong>` tag. E.g., this input:
700
701 *single asterisks*
702
703 _single underscores_
704
705 **double asterisks**
706
707 __double underscores__
708
709 will produce:
710
711 <em>single asterisks</em>
712
713 <em>single underscores</em>
714
715 <strong>double asterisks</strong>
716
717 <strong>double underscores</strong>
718
719 You can use whichever style you prefer; the lone restriction is that
720 the same character must be used to open and close an emphasis span.
721
722 Emphasis can be used in the middle of a word:
723
724 un*fucking*believable
725
726 But if you surround an `*` or `_` with spaces, it'll be treated as a
727 literal asterisk or underscore.
728
729 To produce a literal asterisk or underscore at a position where it
730 would otherwise be used as an emphasis delimiter, you can backslash
731 escape it:
732
733 \*this text is surrounded by literal asterisks\*
734
735
736
737 <h3 id="code">Code</h3>
738
739 To indicate a span of code, wrap it with backtick quotes (`` ` ``).
740 Unlike a pre-formatted code block, a code span indicates code within a
741 normal paragraph. For example:
742
743 Use the `printf()` function.
744
745 will produce:
746
747 <p>Use the <code>printf()</code> function.</p>
748
749 To include a literal backtick character within a code span, you can use
750 multiple backticks as the opening and closing delimiters:
751
752 ``There is a literal backtick (`) here.``
753
754 which will produce this:
755
756 <p><code>There is a literal backtick (`) here.</code></p>
757
758 The backtick delimiters surrounding a code span may include spaces --
759 one after the opening, one before the closing. This allows you to place
760 literal backtick characters at the beginning or end of a code span:
761
762 A single backtick in a code span: `` ` ``
763
764 A backtick-delimited string in a code span: `` `foo` ``
765
766 will produce:
767
768 <p>A single backtick in a code span: <code>`</code></p>
769
770 <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
771
772 With a code span, ampersands and angle brackets are encoded as HTML
773 entities automatically, which makes it easy to include example HTML
774 tags. Markdown will turn this:
775
776 Please don't use any `<blink>` tags.
777
778 into:
779
780 <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
781
782 You can write this:
783
784 `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
785
786 to produce:
787
788 <p><code>&amp;#8212;</code> is the decimal-encoded
789 equivalent of <code>&amp;mdash;</code>.</p>
790
791
792
793 <h3 id="img">Images</h3>
794
795 Admittedly, it's fairly difficult to devise a "natural" syntax for
796 placing images into a plain text document format.
797
798 Markdown uses an image syntax that is intended to resemble the syntax
799 for links, allowing for two styles: *inline* and *reference*.
800
801 Inline image syntax looks like this:
802
803 ![Alt text](/path/to/img.jpg)
804
805 ![Alt text](/path/to/img.jpg "Optional title")
806
807 That is:
808
809 * An exclamation mark: `!`;
810 * followed by a set of square brackets, containing the `alt`
811 attribute text for the image;
812 * followed by a set of parentheses, containing the URL or path to
813 the image, and an optional `title` attribute enclosed in double
814 or single quotes.
815
816 Reference-style image syntax looks like this:
817
818 ![Alt text][id]
819
820 Where "id" is the name of a defined image reference. Image references
821 are defined using syntax identical to link references:
822
823 [id]: url/to/image "Optional title attribute"
824
825 As of this writing, Markdown has no syntax for specifying the
826 dimensions of an image; if this is important to you, you can simply
827 use regular HTML `<img>` tags.
828
829
830 * * *
831
832
833 <h2 id="misc">Miscellaneous</h2>
834
835 <h3 id="autolink">Automatic Links</h3>
836
837 Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
838
839 <http://example.com/>
840
841 Markdown will turn this into:
842
843 <a href="http://example.com/">http://example.com/</a>
844
845 Automatic links for email addresses work similarly, except that
846 Markdown will also perform a bit of randomized decimal and hex
847 entity-encoding to help obscure your address from address-harvesting
848 spambots. For example, Markdown will turn this:
849
850 <address@example.com>
851
852 into something like this:
853
854 <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
855 &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
856 &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
857 &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
858
859 which will render in a browser as a clickable link to "address@example.com".
860
861 (This sort of entity-encoding trick will indeed fool many, if not
862 most, address-harvesting bots, but it definitely won't fool all of
863 them. It's better than nothing, but an address published in this way
864 will probably eventually start receiving spam.)
865
866
867
868 <h3 id="backslash">Backslash Escapes</h3>
869
870 Markdown allows you to use backslash escapes to generate literal
871 characters which would otherwise have special meaning in Markdown's
872 formatting syntax. For example, if you wanted to surround a word with
873 literal asterisks (instead of an HTML `<em>` tag), you can backslashes
874 before the asterisks, like this:
875
876 \*literal asterisks\*
877
878 Markdown provides backslash escapes for the following characters:
879
880 \ backslash
881 ` backtick
882 * asterisk
883 _ underscore
884 {} curly braces
885 [] square brackets
886 () parentheses
887 # hash mark
888 + plus sign
889 - minus sign (hyphen)
890 . dot
891 ! exclamation mark
892
893