3 date: 'Sat 2012-06-09 15:19:14 +0800'
10 基于jekyll的东西写起来比较麻烦,得记CLI,是以留档自用。
13 <li><a href="#jekyll_quick_start">Jekyll Quick Start</a></li>
14 <li><a href="#markdown">On Markdown</a></li>
15 <li><a href="/pages/HelpLiquid.html">On Liquid</a></li>
21 http://jekyllbootstrap.com/usage/jekyll-quick-start.html
29 $ rake post title="Hello World"
33 $ rake page name="about.md"
34 $ rake page name="pages/about.md" # a nested page
35 $ rake page name="pages/about" # a page with a “pretty” path
36 # this will create the file: ./pages/about/index.html
43 <ul id="ProjectSubmenu">
44 <li><a href="http://daringfireball.net/projects/markdown/" title="Markdown Project Page">Markdown Main @ daringfireball.net</a></li>
45 <li><a href="#syntax_cheatsheet" title="Markdown Syntax Cheatsheet">Markdown Cheatsheet</a></li>
46 <li><a href="#markdown_basics" title="Markdown Basics">Markdown Basics</a></li>
47 <li><a href="#markdown_syntax" title="Markdown Syntax Documentation">Markdown Syntax</a></li>
48 <li><a href="http://daringfireball.net/projects/markdown/dingus" title="Online Markdown Web Form">Dingus @ daringfireball.net</a></li>
53 You need to use a special `MTMarkdownOptions` container tag in each
54 Movable Type template where you want HTML 4-style output:
56 <MTMarkdownOptions output='html4'>
57 ... put your entry content here ...
60 The easiest way to use MTMarkdownOptions is probably to put the
61 opening tag right after your `<body>` tag, and the closing tag right
64 To suppress Markdown processing in a particular template, i.e. to
65 publish the raw Markdown-formatted text without translation into
66 (X)HTML, set the `output` attribute to 'raw':
68 <MTMarkdownOptions output='raw'>
69 ... put your entry content here ...
74 ## Syntax Cheatsheet: ##
76 ### Phrase Emphasis ###
86 An [example](http://url.com/ "Title")
88 Reference-style labels (titles are optional):
90 An [example][id]. Then, anywhere
91 else in the doc, define the link:
93 [id]: http://example.com/ "Title"
99 Inline (titles are optional):
101 ![alt text](/path/img.jpg "Title")
107 [id]: /url/to/img.jpg "Title"
120 atx-style (closing #'s are optional):
131 Ordered, without paragraphs:
136 Unordered, with paragraphs:
140 With multiple paragraphs.
158 > Email-style angle brackets
159 > are used for blockquotes.
161 > > And, they can be nested.
163 > #### Headers in blockquotes
165 > * You can quote a list.
171 `<code>` spans are delimited
174 You can include literal backticks
178 ### Preformatted Code Blocks ###
180 Indent every line of a code block by at least 4 spaces or 1 tab.
182 This is a normal paragraph.
184 This is a preformatted
188 ### Horizontal Rules ###
190 Three or more dashes or asterisks:
199 ### Manual Line Breaks ###
201 End a line with two or more spaces:
211 Getting the Gist of Markdown's Formatting Syntax
212 ------------------------------------------------
214 This page offers a brief overview of what it's like to use Markdown.
215 The [syntax page] [s] provides complete, detailed documentation for
216 every feature, but Markdown should be very easy to pick up simply by
217 looking at a few examples of it in action. The examples on this page
218 are written in a before/after style, showing example syntax and the
219 HTML output produced by Markdown.
221 It's also helpful to simply try Markdown out; the [Dingus] [d] is a
222 web application that allows you type your own Markdown-formatted text
223 and translate it to XHTML.
225 **Note:** This document is itself written using Markdown; you
226 can [see the source for it by adding '.text' to the URL] [src].
228 [s]: /projects/markdown/syntax "Markdown Syntax"
229 [d]: /projects/markdown/dingus "Markdown Dingus"
230 [src]: http://daringfireball.net/projects/markdown/basics.text
233 ## Paragraphs, Headers, Blockquotes ##
235 A paragraph is simply one or more consecutive lines of text, separated
236 by one or more blank lines. (A blank line is any line that looks like
237 a blank line -- a line containing nothing but spaces or tabs is
238 considered blank.) Normal paragraphs should not be indented with
241 Markdown offers two styles of headers: *Setext* and *atx*.
242 Setext-style headers for `<h1>` and `<h2>` are created by
243 "underlining" with equal signs (`=`) and hyphens (`-`), respectively.
244 To create an atx-style header, you put 1-6 hash marks (`#`) at the
245 beginning of the line -- the number of hashes equals the resulting
248 Blockquotes are indicated using email-style '`>`' angle brackets.
255 A Second Level Header
256 ---------------------
258 Now is the time for all good men to come to
259 the aid of their country. This is just a
262 The quick brown fox jumped over the lazy
267 > This is a blockquote.
269 > This is the second paragraph in the blockquote.
271 > ## This is an H2 in a blockquote
276 <h1>A First Level Header</h1>
278 <h2>A Second Level Header</h2>
280 <p>Now is the time for all good men to come to
281 the aid of their country. This is just a
282 regular paragraph.</p>
284 <p>The quick brown fox jumped over the lazy
290 <p>This is a blockquote.</p>
292 <p>This is the second paragraph in the blockquote.</p>
294 <h2>This is an H2 in a blockquote</h2>
299 ### Phrase Emphasis ###
301 Markdown uses asterisks and underscores to indicate spans of emphasis.
305 Some of these words *are emphasized*.
306 Some of these words _are emphasized also_.
308 Use two asterisks for **strong emphasis**.
309 Or, if you prefer, __use two underscores instead__.
313 <p>Some of these words <em>are emphasized</em>.
314 Some of these words <em>are emphasized also</em>.</p>
316 <p>Use two asterisks for <strong>strong emphasis</strong>.
317 Or, if you prefer, <strong>use two underscores instead</strong>.</p>
323 Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
324 `+`, and `-`) as list markers. These three markers are
325 interchangable; this:
343 all produce the same output:
351 Ordered (numbered) lists use regular numbers, followed by periods, as
366 If you put blank lines between items, you'll get `<p>` tags for the
367 list item text. You can create multi-paragraph list items by indenting
368 the paragraphs by 4 spaces or 1 tab:
372 With multiple paragraphs.
374 * Another item in the list.
379 <li><p>A list item.</p>
380 <p>With multiple paragraphs.</p></li>
381 <li><p>Another item in the list.</p></li>
388 Markdown supports two styles for creating links: *inline* and
389 *reference*. With both styles, you use square brackets to delimit the
390 text you want to turn into a link.
392 Inline-style links use parentheses immediately after the link text.
395 This is an [example link](http://example.com/).
399 <p>This is an <a href="http://example.com/">
400 example link</a>.</p>
402 Optionally, you may include a title attribute in the parentheses:
404 This is an [example link](http://example.com/ "With a Title").
408 <p>This is an <a href="http://example.com/" title="With a Title">
409 example link</a>.</p>
411 Reference-style links allow you to refer to your links by names, which
412 you define elsewhere in your document:
414 I get 10 times more traffic from [Google][1] than from
415 [Yahoo][2] or [MSN][3].
417 [1]: http://google.com/ "Google"
418 [2]: http://search.yahoo.com/ "Yahoo Search"
419 [3]: http://search.msn.com/ "MSN Search"
423 <p>I get 10 times more traffic from <a href="http://google.com/"
424 title="Google">Google</a> than from <a href="http://search.yahoo.com/"
425 title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
426 title="MSN Search">MSN</a>.</p>
428 The title attribute is optional. Link names may contain letters,
429 numbers and spaces, but are *not* case sensitive:
431 I start my morning with a cup of coffee and
432 [The New York Times][NY Times].
434 [ny times]: http://www.nytimes.com/
438 <p>I start my morning with a cup of coffee and
439 <a href="http://www.nytimes.com/">The New York Times</a>.</p>
444 Image syntax is very much like link syntax.
446 Inline (titles are optional):
448 ![alt text](/path/to/img.jpg "Title")
454 [id]: /path/to/img.jpg "Title"
456 Both of the above examples produce the same output:
458 <img src="/path/to/img.jpg" alt="alt text" title="Title" />
464 In a regular paragraph, you can create code span by wrapping text in
465 backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
466 `>`) will automatically be translated into HTML entities. This makes
467 it easy to use Markdown to write about HTML example code:
469 I strongly recommend against using any `<blink>` tags.
471 I wish SmartyPants used named entities like `—`
472 instead of decimal-encoded entites like `—`.
476 <p>I strongly recommend against using any
477 <code><blink></code> tags.</p>
479 <p>I wish SmartyPants used named entities like
480 <code>&mdash;</code> instead of decimal-encoded
481 entites like <code>&#8212;</code>.</p>
484 To specify an entire block of pre-formatted code, indent every line of
485 the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
486 and `>` characters will be escaped automatically.
490 If you want your page to validate under XHTML 1.0 Strict,
491 you've got to put paragraph tags in your blockquotes:
499 <p>If you want your page to validate under XHTML 1.0 Strict,
500 you've got to put paragraph tags in your blockquotes:</p>
502 <pre><code><blockquote>
503 <p>For example.</p>
512 * [Overview](#overview)
513 * [Philosophy](#philosophy)
514 * [Inline HTML](#html)
515 * [Automatic Escaping for Special Characters](#autoescape)
516 * [Block Elements](#block)
517 * [Paragraphs and Line Breaks](#p)
519 * [Blockquotes](#blockquote)
521 * [Code Blocks](#precode)
522 * [Horizontal Rules](#hr)
523 * [Span Elements](#span)
528 * [Miscellaneous](#misc)
529 * [Backslash Escapes](#backslash)
530 * [Automatic Links](#autolink)
533 **Note:** This document is itself written using Markdown; you
534 can [see the source for it by adding '.text' to the URL][src].
536 [src]: /projects/markdown/syntax.text
540 <h2 id="overview">Overview</h2>
542 <h3 id="philosophy">Philosophy</h3>
544 Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
546 Readability, however, is emphasized above all else. A Markdown-formatted
547 document should be publishable as-is, as plain text, without looking
548 like it's been marked up with tags or formatting instructions. While
549 Markdown's syntax has been influenced by several existing text-to-HTML
550 filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
551 [Grutatext] [5], and [EtText] [6] -- the single biggest source of
552 inspiration for Markdown's syntax is the format of plain text email.
554 [1]: http://docutils.sourceforge.net/mirror/setext.html
555 [2]: http://www.aaronsw.com/2002/atx/
556 [3]: http://textism.com/tools/textile/
557 [4]: http://docutils.sourceforge.net/rst.html
558 [5]: http://www.triptico.com/software/grutatxt.html
559 [6]: http://ettext.taint.org/doc/
561 To this end, Markdown's syntax is comprised entirely of punctuation
562 characters, which punctuation characters have been carefully chosen so
563 as to look like what they mean. E.g., asterisks around a word actually
564 look like \*emphasis\*. Markdown lists look like, well, lists. Even
565 blockquotes look like quoted passages of text, assuming you've ever
570 <h3 id="html">Inline HTML</h3>
572 Markdown's syntax is intended for one purpose: to be used as a
573 format for *writing* for the web.
575 Markdown is not a replacement for HTML, or even close to it. Its
576 syntax is very small, corresponding only to a very small subset of
577 HTML tags. The idea is *not* to create a syntax that makes it easier
578 to insert HTML tags. In my opinion, HTML tags are already easy to
579 insert. The idea for Markdown is to make it easy to read, write, and
580 edit prose. HTML is a *publishing* format; Markdown is a *writing*
581 format. Thus, Markdown's formatting syntax only addresses issues that
582 can be conveyed in plain text.
584 For any markup that is not covered by Markdown's syntax, you simply
585 use HTML itself. There's no need to preface it or delimit it to
586 indicate that you're switching from Markdown to HTML; you just use
589 The only restrictions are that block-level HTML elements -- e.g. `<div>`,
590 `<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
591 content by blank lines, and the start and end tags of the block should
592 not be indented with tabs or spaces. Markdown is smart enough not
593 to add extra (unwanted) `<p>` tags around HTML block-level tags.
595 For example, to add an HTML table to a Markdown article:
597 This is a regular paragraph.
605 This is another regular paragraph.
607 Note that Markdown formatting syntax is not processed within block-level
608 HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
611 Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
612 used anywhere in a Markdown paragraph, list item, or header. If you
613 want, you can even use HTML tags instead of Markdown formatting; e.g. if
614 you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
615 link or image syntax, go right ahead.
617 Unlike block-level HTML tags, Markdown syntax *is* processed within
621 <h3 id="autoescape">Automatic Escaping for Special Characters</h3>
623 In HTML, there are two characters that demand special treatment: `<`
624 and `&`. Left angle brackets are used to start tags; ampersands are
625 used to denote HTML entities. If you want to use them as literal
626 characters, you must escape them as entities, e.g. `<`, and
629 Ampersands in particular are bedeviling for web writers. If you want to
630 write about 'AT&T', you need to write '`AT&T`'. You even need to
631 escape ampersands within URLs. Thus, if you want to link to:
633 http://images.google.com/images?num=30&q=larry+bird
635 you need to encode the URL as:
637 http://images.google.com/images?num=30&q=larry+bird
639 in your anchor tag `href` attribute. Needless to say, this is easy to
640 forget, and is probably the single most common source of HTML validation
641 errors in otherwise well-marked-up web sites.
643 Markdown allows you to use these characters naturally, taking care of
644 all the necessary escaping for you. If you use an ampersand as part of
645 an HTML entity, it remains unchanged; otherwise it will be translated
648 So, if you want to include a copyright symbol in your article, you can write:
652 and Markdown will leave it alone. But if you write:
656 Markdown will translate it to:
660 Similarly, because Markdown supports [inline HTML](#html), if you use
661 angle brackets as delimiters for HTML tags, Markdown will treat them as
662 such. But if you write:
666 Markdown will translate it to:
670 However, inside Markdown code spans and blocks, angle brackets and
671 ampersands are *always* encoded automatically. This makes it easy to use
672 Markdown to write about HTML code. (As opposed to raw HTML, which is a
673 terrible format for writing about HTML syntax, because every single `<`
674 and `&` in your example code needs to be escaped.)
680 <h2 id="block">Block Elements</h2>
683 <h3 id="p">Paragraphs and Line Breaks</h3>
685 A paragraph is simply one or more consecutive lines of text, separated
686 by one or more blank lines. (A blank line is any line that looks like a
687 blank line -- a line containing nothing but spaces or tabs is considered
688 blank.) Normal paragraphs should not be indented with spaces or tabs.
690 The implication of the "one or more consecutive lines of text" rule is
691 that Markdown supports "hard-wrapped" text paragraphs. This differs
692 significantly from most other text-to-HTML formatters (including Movable
693 Type's "Convert Line Breaks" option) which translate every line break
694 character in a paragraph into a `<br />` tag.
696 When you *do* want to insert a `<br />` break tag using Markdown, you
697 end a line with two or more spaces, then type return.
699 Yes, this takes a tad more effort to create a `<br />`, but a simplistic
700 "every line break is a `<br />`" rule wouldn't work for Markdown.
701 Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
702 work best -- and look better -- when you format them with hard breaks.
709 <h3 id="header">Headers</h3>
711 Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
713 Setext-style headers are "underlined" using equal signs (for first-level
714 headers) and dashes (for second-level headers). For example:
722 Any number of underlining `=`'s or `-`'s will work.
724 Atx-style headers use 1-6 hash characters at the start of the line,
725 corresponding to header levels 1-6. For example:
733 Optionally, you may "close" atx-style headers. This is purely
734 cosmetic -- you can use this if you think it looks better. The
735 closing hashes don't even need to match the number of hashes
736 used to open the header. (The number of opening hashes
737 determines the header level.) :
743 ### This is an H3 ######
746 <h3 id="blockquote">Blockquotes</h3>
748 Markdown uses email-style `>` characters for blockquoting. If you're
749 familiar with quoting passages of text in an email message, then you
750 know how to create a blockquote in Markdown. It looks best if you hard
751 wrap the text and put a `>` before every line:
753 > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
754 > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
755 > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
757 > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
758 > id sem consectetuer libero luctus adipiscing.
760 Markdown allows you to be lazy and only put the `>` before the first
761 line of a hard-wrapped paragraph:
763 > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
764 consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
765 Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
767 > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
768 id sem consectetuer libero luctus adipiscing.
770 Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
771 adding additional levels of `>`:
773 > This is the first level of quoting.
775 > > This is nested blockquote.
777 > Back to the first level.
779 Blockquotes can contain other Markdown elements, including headers, lists,
782 > ## This is a header.
784 > 1. This is the first list item.
785 > 2. This is the second list item.
787 > Here's some example code:
789 > return shell_exec("echo $input | $markdown_script");
791 Any decent text editor should make email-style quoting easy. For
792 example, with BBEdit, you can make a selection and choose Increase
793 Quote Level from the Text menu.
796 <h3 id="list">Lists</h3>
798 Markdown supports ordered (numbered) and unordered (bulleted) lists.
800 Unordered lists use asterisks, pluses, and hyphens -- interchangably
819 Ordered lists use numbers followed by periods:
825 It's important to note that the actual numbers you use to mark the
826 list have no effect on the HTML output Markdown produces. The HTML
827 Markdown produces from the above list is:
835 If you instead wrote the list in Markdown like this:
847 you'd get the exact same HTML output. The point is, if you want to,
848 you can use ordinal numbers in your ordered Markdown lists, so that
849 the numbers in your source match the numbers in your published HTML.
850 But if you want to be lazy, you don't have to.
852 If you do use lazy list numbering, however, you should still start the
853 list with the number 1. At some point in the future, Markdown may support
854 starting ordered lists at an arbitrary number.
856 List markers typically start at the left margin, but may be indented by
857 up to three spaces. List markers must be followed by one or more spaces
860 To make lists look nice, you can wrap items with hanging indents:
862 * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
863 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
864 viverra nec, fringilla in, laoreet vitae, risus.
865 * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
866 Suspendisse id sem consectetuer libero luctus adipiscing.
868 But if you want to be lazy, you don't have to:
870 * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
871 Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
872 viverra nec, fringilla in, laoreet vitae, risus.
873 * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
874 Suspendisse id sem consectetuer libero luctus adipiscing.
876 If list items are separated by blank lines, Markdown will wrap the
877 items in `<p>` tags in the HTML output. For example, this input:
899 <li><p>Magic</p></li>
902 List items may consist of multiple paragraphs. Each subsequent
903 paragraph in a list item must be indented by either 4 spaces
906 1. This is a list item with two paragraphs. Lorem ipsum dolor
907 sit amet, consectetuer adipiscing elit. Aliquam hendrerit
910 Vestibulum enim wisi, viverra nec, fringilla in, laoreet
911 vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
914 2. Suspendisse id sem consectetuer libero luctus adipiscing.
916 It looks nice if you indent every line of the subsequent
917 paragraphs, but here again, Markdown will allow you to be
920 * This is a list item with two paragraphs.
922 This is the second paragraph in the list item. You're
923 only required to indent the first line. Lorem ipsum dolor
924 sit amet, consectetuer adipiscing elit.
926 * Another item in the same list.
928 To put a blockquote within a list item, the blockquote's `>`
929 delimiters need to be indented:
931 * A list item with a blockquote:
933 > This is a blockquote
934 > inside a list item.
936 To put a code block within a list item, the code block needs
937 to be indented *twice* -- 8 spaces or two tabs:
939 * A list item with a code block:
944 It's worth noting that it's possible to trigger an ordered list by
945 accident, by writing something like this:
947 1986. What a great season.
949 In other words, a *number-period-space* sequence at the beginning of a
950 line. To avoid this, you can backslash-escape the period:
952 1986\. What a great season.
956 <h3 id="precode">Code Blocks</h3>
958 Pre-formatted code blocks are used for writing about programming or
959 markup source code. Rather than forming normal paragraphs, the lines
960 of a code block are interpreted literally. Markdown wraps a code block
961 in both `<pre>` and `<code>` tags.
963 To produce a code block in Markdown, simply indent every line of the
964 block by at least 4 spaces or 1 tab. For example, given this input:
966 This is a normal paragraph:
968 This is a code block.
970 Markdown will generate:
972 <p>This is a normal paragraph:</p>
974 <pre><code>This is a code block.
977 One level of indentation -- 4 spaces or 1 tab -- is removed from each
978 line of the code block. For example, this:
980 Here is an example of AppleScript:
982 tell application "Foo"
988 <p>Here is an example of AppleScript:</p>
990 <pre><code>tell application "Foo"
995 A code block continues until it reaches a line that is not indented
996 (or the end of the article).
998 Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
999 are automatically converted into HTML entities. This makes it very
1000 easy to include example HTML source code using Markdown -- just paste
1001 it and indent it, and Markdown will handle the hassle of encoding the
1002 ampersands and angle brackets. For example, this:
1004 <div class="footer">
1005 © 2004 Foo Corporation
1010 <pre><code><div class="footer">
1011 &copy; 2004 Foo Corporation
1015 Regular Markdown syntax is not processed within code blocks. E.g.,
1016 asterisks are just literal asterisks within a code block. This means
1017 it's also easy to use Markdown to write about Markdown's own syntax.
1021 <h3 id="hr">Horizontal Rules</h3>
1023 You can produce a horizontal rule tag (`<hr />`) by placing three or
1024 more hyphens, asterisks, or underscores on a line by themselves. If you
1025 wish, you may use spaces between the hyphens or asterisks. Each of the
1026 following lines will produce a horizontal rule:
1036 ---------------------------------------
1041 <h2 id="span">Span Elements</h2>
1043 <h3 id="link">Links</h3>
1045 Markdown supports two style of links: *inline* and *reference*.
1047 In both styles, the link text is delimited by \[square brackets\].
1049 To create an inline link, use a set of regular parentheses immediately
1050 after the link text's closing square bracket. Inside the parentheses,
1051 put the URL where you want the link to point, along with an *optional*
1052 title for the link, surrounded in quotes. For example:
1054 This is [an example](http://example.com/ "Title") inline link.
1056 [This link](http://example.net/) has no title attribute.
1060 <p>This is <a href="http://example.com/" title="Title">
1061 an example</a> inline link.</p>
1063 <p><a href="http://example.net/">This link</a> has no
1064 title attribute.</p>
1066 If you're referring to a local resource on the same server, you can
1069 See my [About](/about/) page for details.
1071 Reference-style links use a second set of square brackets, inside
1072 which you place a label of your choosing to identify the link:
1074 This is [an example][id] reference-style link.
1076 You can optionally use a space to separate the sets of brackets:
1078 This is [an example] [id] reference-style link.
1080 Then, anywhere in the document, you define your link label like this,
1081 on a line by itself:
1083 [id]: http://example.com/ "Optional Title Here"
1087 * Square brackets containing the link identifier (optionally
1088 indented from the left margin using up to three spaces);
1089 * followed by a colon;
1090 * followed by one or more spaces (or tabs);
1091 * followed by the URL for the link;
1092 * optionally followed by a title attribute for the link, enclosed
1093 in double or single quotes, or enclosed in parentheses.
1095 The following three link definitions are equivalent:
1097 [foo]: http://example.com/ "Optional Title Here"
1098 [foo]: http://example.com/ 'Optional Title Here'
1099 [foo]: http://example.com/ (Optional Title Here)
1101 **Note:** There is a known bug in Markdown.pl 1.0.1 which prevents
1102 single quotes from being used to delimit link titles.
1104 The link URL may, optionally, be surrounded by angle brackets:
1106 [id]: <http://example.com/> "Optional Title Here"
1108 You can put the title attribute on the next line and use extra spaces
1109 or tabs for padding, which tends to look better with longer URLs:
1111 [id]: http://example.com/longish/path/to/resource/here
1112 "Optional Title Here"
1114 Link definitions are only used for creating links during Markdown
1115 processing, and are stripped from your document in the HTML output.
1117 Link definition names may consist of letters, numbers, spaces, and
1118 punctuation -- but they are *not* case sensitive. E.g. these two
1126 The *implicit link name* shortcut allows you to omit the name of the
1127 link, in which case the link text itself is used as the name.
1128 Just use an empty set of square brackets -- e.g., to link the word
1129 "Google" to the google.com web site, you could simply write:
1133 And then define the link:
1135 [Google]: http://google.com/
1137 Because link names may contain spaces, this shortcut even works for
1138 multiple words in the link text:
1140 Visit [Daring Fireball][] for more information.
1142 And then define the link:
1144 [Daring Fireball]: http://daringfireball.net/
1146 Link definitions can be placed anywhere in your Markdown document. I
1147 tend to put them immediately after each paragraph in which they're
1148 used, but if you want, you can put them all at the end of your
1149 document, sort of like footnotes.
1151 Here's an example of reference links in action:
1153 I get 10 times more traffic from [Google] [1] than from
1154 [Yahoo] [2] or [MSN] [3].
1156 [1]: http://google.com/ "Google"
1157 [2]: http://search.yahoo.com/ "Yahoo Search"
1158 [3]: http://search.msn.com/ "MSN Search"
1160 Using the implicit link name shortcut, you could instead write:
1162 I get 10 times more traffic from [Google][] than from
1163 [Yahoo][] or [MSN][].
1165 [google]: http://google.com/ "Google"
1166 [yahoo]: http://search.yahoo.com/ "Yahoo Search"
1167 [msn]: http://search.msn.com/ "MSN Search"
1169 Both of the above examples will produce the following HTML output:
1171 <p>I get 10 times more traffic from <a href="http://google.com/"
1172 title="Google">Google</a> than from
1173 <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
1174 or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
1176 For comparison, here is the same paragraph written using
1177 Markdown's inline link style:
1179 I get 10 times more traffic from [Google](http://google.com/ "Google")
1180 than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
1181 [MSN](http://search.msn.com/ "MSN Search").
1183 The point of reference-style links is not that they're easier to
1184 write. The point is that with reference-style links, your document
1185 source is vastly more readable. Compare the above examples: using
1186 reference-style links, the paragraph itself is only 81 characters
1187 long; with inline-style links, it's 176 characters; and as raw HTML,
1188 it's 234 characters. In the raw HTML, there's more markup than there
1191 With Markdown's reference-style links, a source document much more
1192 closely resembles the final output, as rendered in a browser. By
1193 allowing you to move the markup-related metadata out of the paragraph,
1194 you can add links without interrupting the narrative flow of your
1198 <h3 id="em">Emphasis</h3>
1200 Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
1201 emphasis. Text wrapped with one `*` or `_` will be wrapped with an
1202 HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
1203 `<strong>` tag. E.g., this input:
1207 _single underscores_
1209 **double asterisks**
1211 __double underscores__
1215 <em>single asterisks</em>
1217 <em>single underscores</em>
1219 <strong>double asterisks</strong>
1221 <strong>double underscores</strong>
1223 You can use whichever style you prefer; the lone restriction is that
1224 the same character must be used to open and close an emphasis span.
1226 Emphasis can be used in the middle of a word:
1228 un*frigging*believable
1230 But if you surround an `*` or `_` with spaces, it'll be treated as a
1231 literal asterisk or underscore.
1233 To produce a literal asterisk or underscore at a position where it
1234 would otherwise be used as an emphasis delimiter, you can backslash
1237 \*this text is surrounded by literal asterisks\*
1241 <h3 id="code">Code</h3>
1243 To indicate a span of code, wrap it with backtick quotes (`` ` ``).
1244 Unlike a pre-formatted code block, a code span indicates code within a
1245 normal paragraph. For example:
1247 Use the `printf()` function.
1251 <p>Use the <code>printf()</code> function.</p>
1253 To include a literal backtick character within a code span, you can use
1254 multiple backticks as the opening and closing delimiters:
1256 ``There is a literal backtick (`) here.``
1258 which will produce this:
1260 <p><code>There is a literal backtick (`) here.</code></p>
1262 The backtick delimiters surrounding a code span may include spaces --
1263 one after the opening, one before the closing. This allows you to place
1264 literal backtick characters at the beginning or end of a code span:
1266 A single backtick in a code span: `` ` ``
1268 A backtick-delimited string in a code span: `` `foo` ``
1272 <p>A single backtick in a code span: <code>`</code></p>
1274 <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
1276 With a code span, ampersands and angle brackets are encoded as HTML
1277 entities automatically, which makes it easy to include example HTML
1278 tags. Markdown will turn this:
1280 Please don't use any `<blink>` tags.
1284 <p>Please don't use any <code><blink></code> tags.</p>
1288 `—` is the decimal-encoded equivalent of `—`.
1292 <p><code>&#8212;</code> is the decimal-encoded
1293 equivalent of <code>&mdash;</code>.</p>
1297 <h3 id="img">Images</h3>
1299 Admittedly, it's fairly difficult to devise a "natural" syntax for
1300 placing images into a plain text document format.
1302 Markdown uses an image syntax that is intended to resemble the syntax
1303 for links, allowing for two styles: *inline* and *reference*.
1305 Inline image syntax looks like this:
1307 ![Alt text](/path/to/img.jpg)
1309 ![Alt text](/path/to/img.jpg "Optional title")
1313 * An exclamation mark: `!`;
1314 * followed by a set of square brackets, containing the `alt`
1315 attribute text for the image;
1316 * followed by a set of parentheses, containing the URL or path to
1317 the image, and an optional `title` attribute enclosed in double
1320 Reference-style image syntax looks like this:
1324 Where "id" is the name of a defined image reference. Image references
1325 are defined using syntax identical to link references:
1327 [id]: url/to/image "Optional title attribute"
1329 As of this writing, Markdown has no syntax for specifying the
1330 dimensions of an image; if this is important to you, you can simply
1331 use regular HTML `<img>` tags.
1337 <h2 id="misc">Miscellaneous</h2>
1339 <h3 id="autolink">Automatic Links</h3>
1341 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:
1343 <http://example.com/>
1345 Markdown will turn this into:
1347 <a href="http://example.com/">http://example.com/</a>
1349 Automatic links for email addresses work similarly, except that
1350 Markdown will also perform a bit of randomized decimal and hex
1351 entity-encoding to help obscure your address from address-harvesting
1352 spambots. For example, Markdown will turn this:
1354 <address@example.com>
1356 into something like this:
1358 <a href="mailto:addre
1359 ss@example.co
1360 m">address@exa
1361 mple.com</a>
1363 which will render in a browser as a clickable link to "address@example.com".
1365 (This sort of entity-encoding trick will indeed fool many, if not
1366 most, address-harvesting bots, but it definitely won't fool all of
1367 them. It's better than nothing, but an address published in this way
1368 will probably eventually start receiving spam.)
1372 <h3 id="backslash">Backslash Escapes</h3>
1374 Markdown allows you to use backslash escapes to generate literal
1375 characters which would otherwise have special meaning in Markdown's
1376 formatting syntax. For example, if you wanted to surround a word
1377 with literal asterisks (instead of an HTML `<em>` tag), you can use
1378 backslashes before the asterisks, like this:
1380 \*literal asterisks\*
1382 Markdown provides backslash escapes for the following characters:
1393 - minus sign (hyphen)