From 0b03460f9faa9a4645d552b7adf433d88b51898a Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Sat, 10 Feb 2024 23:00:28 +0100 Subject: [PATCH] Treat HTML as inline element --- src/unstable_markdown.rs | 25 ++++++-- ...pshots__markdown@markdown_basics.md-2.snap | 6 +- ...pshots__markdown@markdown_basics.md-3.snap | 6 +- ...napshots__markdown@markdown_basics.md.snap | 3 +- ...pshots__markdown@markdown_syntax.md-2.snap | 58 ++++++++++--------- ...pshots__markdown@markdown_syntax.md-3.snap | 36 +++++++----- ...napshots__markdown@markdown_syntax.md.snap | 3 +- ...s__markdown_trim@markdown_basics.md-3.snap | 6 +- ...s__markdown_trim@markdown_syntax.md-2.snap | 19 +++--- ...s__markdown_trim@markdown_syntax.md-3.snap | 36 +++++++----- 10 files changed, 114 insertions(+), 84 deletions(-) diff --git a/src/unstable_markdown.rs b/src/unstable_markdown.rs index de04018..462150c 100644 --- a/src/unstable_markdown.rs +++ b/src/unstable_markdown.rs @@ -159,10 +159,10 @@ enum SemanticLevel { SoftBreak, /// An inline element that is within a larger element such as a paragraph, but /// more specific than a sentence. - /// Falls back to [`Self::Sentence`] + /// Falls back to [`Self::SoftBreak`] InlineElement(SemanticSplitPosition), /// Hard line break (two newlines), which signifies a new element in Markdown - /// Falls back to [`Self::SoftBreak`] + /// Falls back to [`Self::InlineElement`] HardBreak, /// thematic break/horizontal rule Rule, @@ -207,8 +207,8 @@ impl SemanticSplit for Markdown { let ranges = Parser::new_ext(text, Options::all()) .into_offset_iter() .filter_map(|(event, range)| match dbg!(event) { - Event::Start(_) | Event::End(_) | Event::Html(_) | Event::Text(_) => None, - Event::Code(_) => Some(( + Event::Start(_) | Event::End(_) | Event::Text(_) => None, + Event::Code(_) | Event::Html(_) => Some(( SemanticLevel::InlineElement(SemanticSplitPosition::Own), range, )), @@ -529,6 +529,23 @@ mod tests { ); } + #[test] + fn test_html() { + let markdown = Markdown::new("
Some text
"); + + assert_eq!( + vec![&( + SemanticLevel::InlineElement(SemanticSplitPosition::Own), + 0..20 + ),], + markdown.ranges().collect::>() + ); + assert_eq!( + SemanticLevel::InlineElement(SemanticSplitPosition::Own), + markdown.max_level() + ); + } + #[test] fn test_softbreak() { let markdown = Markdown::new("Some text\nwith a softbreak"); diff --git a/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-2.snap b/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-2.snap index ddb3919..96e7aba 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-2.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-2.snap @@ -9,9 +9,9 @@ input_file: tests/inputs/markdown/markdown_basics.md - "
  • Syntax
  • \n" - "
  • License\n
  • Dingus
  • \n" -- "\n\n\nGetting the Gist of Markdown's Formatting Syntax\n" -- "------------------------------------------------\n\n" -- "This page offers a brief overview of what it's like to use Markdown.\n" +- "\n" +- "\n\nGetting the Gist of Markdown's Formatting Syntax\n------------------------------------------------\n" +- "\nThis page offers a brief overview of what it's like to use Markdown.\n" - "The [syntax page] [s] provides complete, detailed documentation for\n" - "every feature, but Markdown should be very easy to pick up simply by\n" - "looking at a few examples of it in action. The examples on this page\n" diff --git a/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-3.snap b/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-3.snap index 720d204..b0aa59a 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-3.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md-3.snap @@ -3,9 +3,9 @@ source: tests/text_splitter_snapshots.rs expression: chunks input_file: tests/inputs/markdown/markdown_basics.md --- -- "Markdown: Basics\n================\n\n\n\n\nGetting the Gist of Markdown's Formatting Syntax\n------------------------------------------------\n\nThis page offers a brief overview of what it's like to use Markdown.\nThe [syntax page] [s] provides complete, detailed documentation for\nevery feature, but Markdown should be very easy to pick up simply by\nlooking at a few examples of it in action. The examples on this page\nare written in a before/after style, showing example syntax and the\n" -- "HTML output produced by Markdown.\n\nIt's also helpful to simply try Markdown out; the [Dingus] [d] is a\nweb application that allows you type your own Markdown-formatted text\nand translate it to XHTML.\n\n**Note:** This document is itself written using Markdown; you\ncan [see the source for it by adding '.text' to the URL] [src].\n\n [s]: /projects/markdown/syntax \"Markdown Syntax\"\n [d]: /projects/markdown/dingus \"Markdown Dingus\"\n [src]: /projects/markdown/basics.text\n\n\n## Paragraphs, Headers, Blockquotes ##\n\nA paragraph is simply one or more consecutive lines of text, separated\nby one or more blank lines. (A blank line is any line that looks like\na blank line -- a line containing nothing but spaces or tabs is\nconsidered blank.) Normal paragraphs should not be indented with\nspaces or tabs.\n\nMarkdown offers two styles of headers: *Setext* and *atx*.\nSetext-style headers for `

    ` and `

    ` are created by\n\"underlining\" with equal signs (`=`) and hyphens (`-`" -- "), respectively.\nTo create an atx-style header, you put 1-6 hash marks (`#`) at the\nbeginning of the line -- the number of hashes equals the resulting\nHTML header level.\n\nBlockquotes are indicated using email-style '`>`" +- "Markdown: Basics\n================\n\n\n" +- "\n\nGetting the Gist of Markdown's Formatting Syntax\n------------------------------------------------\n\nThis page offers a brief overview of what it's like to use Markdown.\nThe [syntax page] [s] provides complete, detailed documentation for\nevery feature, but Markdown should be very easy to pick up simply by\nlooking at a few examples of it in action. The examples on this page\nare written in a before/after style, showing example syntax and the\nHTML output produced by Markdown.\n\nIt's also helpful to simply try Markdown out; the [Dingus] [d] is a\nweb application that allows you type your own Markdown-formatted text\nand translate it to XHTML.\n\n**Note:** This document is itself written using Markdown; you\n" +- "can [see the source for it by adding '.text' to the URL] [src].\n\n [s]: /projects/markdown/syntax \"Markdown Syntax\"\n [d]: /projects/markdown/dingus \"Markdown Dingus\"\n [src]: /projects/markdown/basics.text\n\n\n## Paragraphs, Headers, Blockquotes ##\n\nA paragraph is simply one or more consecutive lines of text, separated\nby one or more blank lines. (A blank line is any line that looks like\na blank line -- a line containing nothing but spaces or tabs is\nconsidered blank.) Normal paragraphs should not be indented with\nspaces or tabs.\n\nMarkdown offers two styles of headers: *Setext* and *atx*.\nSetext-style headers for `

    ` and `

    ` are created by\n\"underlining\" with equal signs (`=`) and hyphens (`-`), respectively.\nTo create an atx-style header, you put 1-6 hash marks (`#`) at the\nbeginning of the line -- the number of hashes equals the resulting\nHTML header level.\n\nBlockquotes are indicated using email-style '`>`" - "' angle brackets.\n\nMarkdown:\n\n A First Level Header\n ====================\n\n A Second Level Header\n ---------------------\n\n Now is the time for all good men to come to\n the aid of their country. This is just a\n regular paragraph.\n\n The quick brown fox jumped over the lazy\n dog's back.\n\n ### Header 3\n\n > This is a blockquote.\n >\n > This is the second paragraph in the blockquote.\n >\n > ## This is an H2 in a blockquote\n\n\nOutput:\n\n

    A First Level Header

    \n\n

    A Second Level Header

    \n\n

    Now is the time for all good men to come to\n the aid of their country. This is just a\n regular paragraph.

    \n\n

    The quick brown fox jumped over the lazy\n dog's back.

    \n\n

    Header 3

    \n\n
    \n

    This is a blockquote.

    \n\n

    This is the second paragraph in the blockquote.

    \n\n

    This is an H2 in a blockquote

    \n
    \n\n\n\n### Phrase Emphasis ###\n\n" - "Markdown uses asterisks and underscores to indicate spans of emphasis.\n\nMarkdown:\n\n Some of these words *are emphasized*.\n Some of these words _are emphasized also_.\n\n Use two asterisks for **strong emphasis**.\n Or, if you prefer, __use two underscores instead__.\n\nOutput:\n\n

    Some of these words are emphasized.\n Some of these words are emphasized also.

    \n\n

    Use two asterisks for strong emphasis.\n Or, if you prefer, use two underscores instead.

    \n\n\n\n## Lists ##\n\nUnordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,\n`+`, and `-`" - ") as list markers. These three markers are\ninterchangable; this:\n\n * Candy.\n * Gum.\n * Booze.\n\nthis:\n\n + Candy.\n + Gum.\n + Booze.\n\nand this:\n\n - Candy.\n - Gum.\n - Booze.\n\nall produce the same output:\n\n \n\nOrdered (numbered) lists use regular numbers, followed by periods, as\nlist markers:\n\n 1. Red\n 2. Green\n 3. Blue\n\nOutput:\n\n
      \n
    1. Red
    2. \n
    3. Green
    4. \n
    5. Blue
    6. \n
    \n\nIf you put blank lines between items, you'll get `

    `" diff --git a/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md.snap b/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md.snap index 73e9605..ff2b21d 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown@markdown_basics.md.snap @@ -62,7 +62,8 @@ input_file: tests/inputs/markdown/markdown_basics.md - "Web Form\">" - Dingus - "\n" -- "\n\n\n" +- "\n" +- "\n\n" - "Getting " - "the Gist " - "of " diff --git a/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-2.snap b/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-2.snap index 3713dd7..dc796ff 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-2.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-2.snap @@ -9,7 +9,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "

  • Syntax
  • \n" - "
  • License\n
  • Dingus
  • \n" -- "\n\n\n* [Overview](#overview)\n * [Philosophy](#philosophy)\n * [Inline HTML](#html)\n" +- "\n" +- "\n\n* [Overview](#overview)\n * [Philosophy](#philosophy)\n * [Inline HTML](#html)\n" - " * [Automatic Escaping for Special Characters](#autoescape)\n* [Block Elements](#block)\n" - " * [Paragraphs and Line Breaks](#p)\n * [Headers](#header)\n" - " * [Blockquotes](#blockquote)\n * [Lists](#list)\n * [Code Blocks](#precode)\n" @@ -19,8 +20,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "**Note:** This document is itself written using Markdown; you\n" - "can [see the source for it by adding '.text' to the URL][src].\n\n" - " [src]: /projects/markdown/syntax.text\n\n* * *\n" -- "\n

    Overview

    \n\n

    Philosophy

    \n\n" -- "Markdown is intended to be as easy-to-read and easy-to-write as is feasible.\n\n" +- "\n

    Overview

    \n\n

    Philosophy

    \n" +- "\nMarkdown is intended to be as easy-to-read and easy-to-write as is feasible.\n\n" - "Readability, however, is emphasized above all else. A Markdown-formatted\n" - "document should be publishable as-is, as plain text, without looking\n" - "like it's been marked up with tags or formatting instructions. While\n" @@ -36,9 +37,9 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "characters, which punctuation characters have been carefully chosen so\n" - "as to look like what they mean. E.g., asterisks around a word actually\n" - "look like \\*emphasis\\*. Markdown lists look like, well, lists. Even\n" -- "blockquotes look like quoted passages of text, assuming you've ever\n" -- "used email.\n\n\n\n

    Inline HTML

    \n\n" -- "Markdown's syntax is intended for one purpose: to be used as a\n" +- "blockquotes look like quoted passages of text, assuming you've ever\nused email.\n\n\n\n" +- "

    Inline HTML

    \n" +- "\nMarkdown's syntax is intended for one purpose: to be used as a\n" - "format for *writing* for the web.\n\nMarkdown is not a replacement for HTML, or even close to it. Its\n" - "syntax is very small, corresponding only to a very small subset of\n" - "HTML tags. The idea is *not* to create a syntax that makes it easier\n" @@ -65,9 +66,9 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "`` or ``" - " tags instead of Markdown's\n" - "link or image syntax, go right ahead.\n\n" -- "Unlike block-level HTML tags, Markdown syntax *is* processed within\n" -- "span-level tags.\n\n\n

    Automatic Escaping for Special Characters

    \n\n" -- "In HTML, there are two characters that demand special treatment: `<`\nand `&`" +- "Unlike block-level HTML tags, Markdown syntax *is* processed within\nspan-level tags.\n\n\n" +- "

    Automatic Escaping for Special Characters

    \n" +- "\nIn HTML, there are two characters that demand special treatment: `<`\nand `&`" - ". Left angle brackets are used to start tags; ampersands are\n" - "used to denote HTML entities. If you want to use them as literal\n" - "characters, you must escape them as entities, e.g. `<`, and\n`&`" @@ -93,8 +94,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "Markdown to write about HTML code. (As opposed to raw HTML, which is a\n" - "terrible format for writing about HTML syntax, because every single `<`\nand `&`" - " in your example code needs to be escaped.)\n\n\n* * *\n" -- "\n\n

    Block Elements

    \n\n\n

    Paragraphs and Line Breaks

    \n\n" -- "A paragraph is simply one or more consecutive lines of text, separated\n" +- "\n\n

    Block Elements

    \n\n\n

    Paragraphs and Line Breaks

    \n" +- "\nA paragraph is simply one or more consecutive lines of text, separated\n" - "by one or more blank lines. (A blank line is any line that looks like a\n" - "blank line -- a line containing nothing but spaces or tabs is considered\n" - "blank.) Normal paragraphs should not be indented with spaces or tabs.\n\n" @@ -110,8 +111,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "\" rule wouldn't work for Markdown.\n" - "Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]\n" - "work best -- and look better -- when you format them with hard breaks.\n\n [bq]: #blockquote\n" -- " [l]: #list\n\n\n\n

    Headers

    \n\n" -- "Markdown supports two styles of headers, [Setext] [1] and [atx] [2].\n\n" +- " [l]: #list\n\n\n\n

    Headers

    \n" +- "\nMarkdown supports two styles of headers, [Setext] [1] and [atx] [2].\n\n" - "Setext-style headers are \"underlined\" using equal signs (for first-level\n" - "headers) and dashes (for second-level headers). For example:\n\n This is an H1\n =============\n\n" - " This is an H2\n -------------\n\nAny number of underlining `=`'s or `-`" @@ -147,8 +148,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "\t> return shell_exec(\"echo $input | $markdown_script\");\n\n" - "Any decent text editor should make email-style quoting easy. For\n" - "example, with BBEdit, you can make a selection and choose Increase\n" -- "Quote Level from the Text menu.\n\n\n

    Lists

    \n\n" -- "Markdown supports ordered (numbered) and unordered (bulleted) lists.\n\n" +- "Quote Level from the Text menu.\n\n\n

    Lists

    \n" +- "\nMarkdown supports ordered (numbered) and unordered (bulleted) lists.\n\n" - "Unordered lists use asterisks, pluses, and hyphens -- interchangably\n" - "-- as list markers:\n\n * Red\n * Green\n * Blue\n\nis equivalent to:\n\n + Red\n" - " + Green\n + Blue\n\nand:\n\n - Red\n - Green\n - Blue\n\n" @@ -205,8 +206,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "accident, by writing something like this:\n\n 1986. What a great season.\n\n" - "In other words, a *number-period-space* sequence at the beginning of a\n" - "line. To avoid this, you can backslash-escape the period:\n\n 1986\\. What a great season.\n\n\n\n" -- "

    Code Blocks

    \n\n" -- "Pre-formatted code blocks are used for writing about programming or\n" +- "

    Code Blocks

    \n" +- "\nPre-formatted code blocks are used for writing about programming or\n" - "markup source code. Rather than forming normal paragraphs, the lines\n" - "of a code block are interpreted literally. Markdown wraps a code block\nin both `
    ` and ``"
     - " tags.\n\nTo produce a code block in Markdown, simply indent every line of the\n"
    @@ -233,8 +234,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md
     - "wish, you may use spaces between the hyphens or asterisks. Each of the\n"
     - "following lines will produce a horizontal rule:\n\n    * * *\n\n    ***\n\n    *****\n\n    - - -\n\n"
     - "    ---------------------------------------\n\n\n* * *\n"
    -- "\n

    Span Elements

    \n\n

    Links

    \n\n" -- "Markdown supports two style of links: *inline* and *reference*.\n\n" +- "\n

    Span Elements

    \n\n

    Links

    \n" +- "\nMarkdown supports two style of links: *inline* and *reference*.\n\n" - "In both styles, the link text is delimited by [square brackets].\n\n" - "To create an inline link, use a set of regular parentheses immediately\n" - "after the link text's closing square bracket. Inside the parentheses,\n" @@ -313,8 +314,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "is text.\n\nWith Markdown's reference-style links, a source document much more\n" - "closely resembles the final output, as rendered in a browser. By\n" - "allowing you to move the markup-related metadata out of the paragraph,\n" -- "you can add links without interrupting the narrative flow of your\n" -- "prose.\n\n\n

    Emphasis

    \n\nMarkdown treats asterisks (`*`) and underscores (`_`" +- "you can add links without interrupting the narrative flow of your\nprose.\n\n\n" +- "

    Emphasis

    \n\nMarkdown treats asterisks (`*`) and underscores (`_`" - ") as indicators of\nemphasis. Text wrapped with one `*` or `_` will be wrapped with an\nHTML ``" - " tag; double `*`'s or `_`'s will be wrapped with an HTML\n``" - " tag. E.g., this input:\n\n *single asterisks*\n\n _single underscores_\n\n **double asterisks**\n" @@ -328,8 +329,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - " with spaces, it'll be treated as a\n" - "literal asterisk or underscore.\n\nTo produce a literal asterisk or underscore at a position where it\n" - "would otherwise be used as an emphasis delimiter, you can backslash\n" -- "escape it:\n\n \\*this text is surrounded by literal asterisks\\*\n\n\n\n

    Code

    \n\n" -- "To indicate a span of code, wrap it with backtick quotes (`` ` ``" +- "escape it:\n\n \\*this text is surrounded by literal asterisks\\*\n\n\n\n

    Code

    \n" +- "\nTo indicate a span of code, wrap it with backtick quotes (`` ` ``" - ").\nUnlike a pre-formatted code block, a code span indicates code within a\n" - "normal paragraph. For example:\n\n Use the `printf()` function.\n\nwill produce:\n\n" - "

    Use the printf() function.

    \n\n" @@ -350,8 +351,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "

    Please don't use any <blink> tags.

    \n\nYou can write this:\n\n" - " `—` is the decimal-encoded equivalent of `—`.\n\nto produce:\n\n" - "

    &#8212; is the decimal-encoded\n" -- " equivalent of &mdash;.

    \n\n\n\n

    Images

    \n\n" -- "Admittedly, it's fairly difficult to devise a \"natural\" syntax for\n" +- " equivalent of &mdash;.

    \n\n\n\n

    Images

    \n" +- "\nAdmittedly, it's fairly difficult to devise a \"natural\" syntax for\n" - "placing images into a plain text document format.\n\n" - "Markdown uses an image syntax that is intended to resemble the syntax\n" - "for links, allowing for two styles: *inline* and *reference*.\n\nInline image syntax looks like this:\n" @@ -369,7 +370,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "As of this writing, Markdown has no syntax for specifying the\n" - "dimensions of an image; if this is important to you, you can simply\nuse regular HTML ``" - " tags.\n\n\n* * *\n" -- "\n\n

    Miscellaneous

    \n\n

    Automatic Links

    \n\n" +- "\n\n

    Miscellaneous

    \n\n

    Automatic Links

    \n" +- "\n" - "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" @@ -388,8 +390,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "(This sort of entity-encoding trick will indeed fool many, if not\n" - "most, address-harvesting bots, but it definitely won't fool all of\n" - "them. It's better than nothing, but an address published in this way\n" -- "will probably eventually start receiving spam.)\n\n\n\n

    Backslash Escapes

    \n\n" -- "Markdown allows you to use backslash escapes to generate literal\n" +- "will probably eventually start receiving spam.)\n\n\n\n

    Backslash Escapes

    \n" +- "\nMarkdown allows you to use backslash escapes to generate literal\n" - "characters which would otherwise have special meaning in Markdown's\n" - "formatting syntax. For example, if you wanted to surround a word\n" - "with literal asterisks (instead of an HTML ``" diff --git a/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-3.snap b/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-3.snap index 9875da0..09e2ab1 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-3.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md-3.snap @@ -3,40 +3,44 @@ source: tests/text_splitter_snapshots.rs expression: chunks input_file: tests/inputs/markdown/markdown_syntax.md --- -- "Markdown: Syntax\n================\n\n
    \n\n\n* [Overview](#overview)\n * [Philosophy](#philosophy)\n * [Inline HTML](#html)\n * [Automatic Escaping for Special Characters](#autoescape)\n* [Block Elements](#block)\n * [Paragraphs and Line Breaks](#p)\n * [Headers](#header)\n * [Blockquotes](#blockquote)\n * [Lists](#list)\n * [Code Blocks](#precode)\n * [Horizontal Rules](#hr)\n* [Span Elements](#span)\n * [Links](#link)\n * [Emphasis](#em)\n * [Code](#code)\n" -- " * [Images](#img)\n* [Miscellaneous](#misc)\n * [Backslash Escapes](#backslash)\n * [Automatic Links](#autolink)\n\n\n**Note:** This document is itself written using Markdown; you\ncan [see the source for it by adding '.text' to the URL][src].\n\n [src]: /projects/markdown/syntax.text\n\n* * *\n" -- "\n

    Overview

    \n\n

    Philosophy

    \n\nMarkdown is intended to be as easy-to-read and easy-to-write as is feasible.\n\nReadability, however, is emphasized above all else. A Markdown-formatted\ndocument should be publishable as-is, as plain text, without looking\nlike it's been marked up with tags or formatting instructions. While\nMarkdown's syntax has been influenced by several existing text-to-HTML\nfilters -- including [Setext][1], [atx][2], [Textile][3], [reStructuredText][4],\n[Grutatext][5], and [EtText][6] -- the single biggest source of\n" -- "inspiration for Markdown's syntax is the format of plain text email.\n\n [1]: http://docutils.sourceforge.net/mirror/setext.html\n [2]: http://www.aaronsw.com/2002/atx/\n [3]: https://web.archive.org/web/20021226035527/http://textism.com/tools/textile/\n [4]: http://docutils.sourceforge.net/rst.html\n [5]: http://www.triptico.com/software/grutatxt.html\n [6]: http://ettext.taint.org/doc/\n\nTo this end, Markdown's syntax is comprised entirely of punctuation\ncharacters, which punctuation characters have been carefully chosen so\nas to look like what they mean. E.g., asterisks around a word actually\nlook like \\*emphasis\\*. Markdown lists look like, well, lists. Even\nblockquotes look like quoted passages of text, assuming you've ever\nused email.\n\n\n\n

    Inline HTML

    \n\nMarkdown's syntax is intended for one purpose: to be used as a\nformat for *writing* for the web.\n\nMarkdown is not a replacement for HTML, or even close to it. Its\n" -- "syntax is very small, corresponding only to a very small subset of\nHTML tags. The idea is *not* to create a syntax that makes it easier\nto insert HTML tags. In my opinion, HTML tags are already easy to\ninsert. The idea for Markdown is to make it easy to read, write, and\nedit prose. HTML is a *publishing* format; Markdown is a *writing*\nformat. Thus, Markdown's formatting syntax only addresses issues that\ncan be conveyed in plain text.\n\nFor any markup that is not covered by Markdown's syntax, you simply\nuse HTML itself. There's no need to preface it or delimit it to\nindicate that you're switching from Markdown to HTML; you just use\nthe tags.\n\nThe only restrictions are that block-level HTML elements -- e.g. `
    `,\n``, `
    `, `

    `, etc. -- must be separated from surrounding\ncontent by blank lines, and the start and end tags of the block should\nnot be indented with tabs or spaces. Markdown is smart enough not\nto add extra (unwanted) `

    `" -- " tags around HTML block-level tags.\n\nFor example, to add an HTML table to a Markdown article:\n\n This is a regular paragraph.\n\n

    \n \n \n \n
    Foo
    \n\n This is another regular paragraph.\n\nNote that Markdown formatting syntax is not processed within block-level\nHTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an\nHTML block.\n\nSpan-level HTML tags -- e.g. ``, ``, or `` -- can be\nused anywhere in a Markdown paragraph, list item, or header. If you\nwant, you can even use HTML tags instead of Markdown formatting; e.g. if\nyou'd prefer to use HTML `` or `` tags instead of Markdown's\nlink or image syntax, go right ahead.\n\nUnlike block-level HTML tags, Markdown syntax *is* processed within\nspan-level tags.\n\n\n

    Automatic Escaping for Special Characters

    \n\nIn HTML, there are two characters that demand special treatment: `<`\nand `&`" -- ". Left angle brackets are used to start tags; ampersands are\nused to denote HTML entities. If you want to use them as literal\ncharacters, you must escape them as entities, e.g. `<`, and\n`&`.\n\nAmpersands in particular are bedeviling for web writers. If you want to\nwrite about 'AT&T', you need to write '`AT&T`'. You even need to\nescape ampersands within URLs. Thus, if you want to link to:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nyou need to encode the URL as:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nin your anchor tag `href` attribute. Needless to say, this is easy to\nforget, and is probably the single most common source of HTML validation\nerrors in otherwise well-marked-up web sites.\n\nMarkdown allows you to use these characters naturally, taking care of\nall the necessary escaping for you. If you use an ampersand as part of\nan HTML entity, it remains unchanged; otherwise it will be translated\ninto `&`" +- "Markdown: Syntax\n================\n\n
    \n" +- "\n\n* [Overview](#overview)\n * [Philosophy](#philosophy)\n * [Inline HTML](#html)\n * [Automatic Escaping for Special Characters](#autoescape)\n* [Block Elements](#block)\n * [Paragraphs and Line Breaks](#p)\n * [Headers](#header)\n * [Blockquotes](#blockquote)\n * [Lists](#list)\n * [Code Blocks](#precode)\n * [Horizontal Rules](#hr)\n* [Span Elements](#span)\n * [Links](#link)\n * [Emphasis](#em)\n * [Code](#code)\n * [Images](#img)\n* [Miscellaneous](#misc)\n * [Backslash Escapes](#backslash)\n * [Automatic Links](#autolink)\n\n\n**Note:** This document is itself written using Markdown; you\ncan [see the source for it by adding '.text' to the URL][src].\n\n [src]: /projects/markdown/syntax.text\n\n* * *\n" +- "\n

    Overview

    \n\n

    Philosophy

    \n" +- "\nMarkdown is intended to be as easy-to-read and easy-to-write as is feasible.\n\nReadability, however, is emphasized above all else. A Markdown-formatted\ndocument should be publishable as-is, as plain text, without looking\nlike it's been marked up with tags or formatting instructions. While\nMarkdown's syntax has been influenced by several existing text-to-HTML\nfilters -- including [Setext][1], [atx][2], [Textile][3], [reStructuredText][4],\n[Grutatext][5], and [EtText][6] -- the single biggest source of\ninspiration for Markdown's syntax is the format of plain text email.\n\n [1]: http://docutils.sourceforge.net/mirror/setext.html\n [2]: http://www.aaronsw.com/2002/atx/\n [3]: https://web.archive.org/web/20021226035527/http://textism.com/tools/textile/\n [4]: http://docutils.sourceforge.net/rst.html\n [5]: http://www.triptico.com/software/grutatxt.html\n [6]: http://ettext.taint.org/doc/\n\nTo this end, Markdown's syntax is comprised entirely of punctuation\n" +- "characters, which punctuation characters have been carefully chosen so\nas to look like what they mean. E.g., asterisks around a word actually\nlook like \\*emphasis\\*. Markdown lists look like, well, lists. Even\nblockquotes look like quoted passages of text, assuming you've ever\nused email.\n\n\n\n

    Inline HTML

    \n" +- "\nMarkdown's syntax is intended for one purpose: to be used as a\nformat for *writing* for the web.\n\nMarkdown is not a replacement for HTML, or even close to it. Its\nsyntax is very small, corresponding only to a very small subset of\nHTML tags. The idea is *not* to create a syntax that makes it easier\nto insert HTML tags. In my opinion, HTML tags are already easy to\ninsert. The idea for Markdown is to make it easy to read, write, and\nedit prose. HTML is a *publishing* format; Markdown is a *writing*\nformat. Thus, Markdown's formatting syntax only addresses issues that\ncan be conveyed in plain text.\n\nFor any markup that is not covered by Markdown's syntax, you simply\nuse HTML itself. There's no need to preface it or delimit it to\nindicate that you're switching from Markdown to HTML; you just use\nthe tags.\n\nThe only restrictions are that block-level HTML elements -- e.g. `
    `,\n``, `
    `, `

    `" +- ", etc. -- must be separated from surrounding\ncontent by blank lines, and the start and end tags of the block should\nnot be indented with tabs or spaces. Markdown is smart enough not\nto add extra (unwanted) `

    ` tags around HTML block-level tags.\n\nFor example, to add an HTML table to a Markdown article:\n\n This is a regular paragraph.\n\n

    \n \n \n \n
    Foo
    \n\n This is another regular paragraph.\n\nNote that Markdown formatting syntax is not processed within block-level\nHTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an\nHTML block.\n\nSpan-level HTML tags -- e.g. ``, ``, or `` -- can be\nused anywhere in a Markdown paragraph, list item, or header. If you\nwant, you can even use HTML tags instead of Markdown formatting; e.g. if\nyou'd prefer to use HTML `` or ``" +- " tags instead of Markdown's\nlink or image syntax, go right ahead.\n\nUnlike block-level HTML tags, Markdown syntax *is* processed within\nspan-level tags.\n\n\n

    Automatic Escaping for Special Characters

    \n\nIn HTML, there are two characters that demand special treatment: `<`\nand `&`. Left angle brackets are used to start tags; ampersands are\nused to denote HTML entities. If you want to use them as literal\ncharacters, you must escape them as entities, e.g. `<`, and\n`&`.\n\nAmpersands in particular are bedeviling for web writers. If you want to\nwrite about 'AT&T', you need to write '`AT&T`'. You even need to\nescape ampersands within URLs. Thus, if you want to link to:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nyou need to encode the URL as:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nin your anchor tag `href`" +- " attribute. Needless to say, this is easy to\nforget, and is probably the single most common source of HTML validation\nerrors in otherwise well-marked-up web sites.\n\nMarkdown allows you to use these characters naturally, taking care of\nall the necessary escaping for you. If you use an ampersand as part of\nan HTML entity, it remains unchanged; otherwise it will be translated\ninto `&`" - ".\n\nSo, if you want to include a copyright symbol in your article, you can write:\n\n ©\n\nand Markdown will leave it alone. But if you write:\n\n AT&T\n\nMarkdown will translate it to:\n\n AT&T\n\nSimilarly, because Markdown supports [inline HTML](#html), if you use\nangle brackets as delimiters for HTML tags, Markdown will treat them as\nsuch. But if you write:\n\n 4 < 5\n\nMarkdown will translate it to:\n\n 4 < 5\n\nHowever, inside Markdown code spans and blocks, angle brackets and\nampersands are *always* encoded automatically. This makes it easy to use\nMarkdown to write about HTML code. (As opposed to raw HTML, which is a\nterrible format for writing about HTML syntax, because every single `<`\nand `&` in your example code needs to be escaped.)\n\n\n* * *\n" - "\n\n

    Block Elements

    \n\n\n

    Paragraphs and Line Breaks

    \n\nA paragraph is simply one or more consecutive lines of text, separated\nby one or more blank lines. (A blank line is any line that looks like a\nblank line -- a line containing nothing but spaces or tabs is considered\nblank.) Normal paragraphs should not be indented with spaces or tabs.\n\nThe implication of the \"one or more consecutive lines of text\" rule is\nthat Markdown supports \"hard-wrapped\" text paragraphs. This differs\nsignificantly from most other text-to-HTML formatters (including Movable\nType's \"Convert Line Breaks\" option) which translate every line break\ncharacter in a paragraph into a `
    ` tag.\n\nWhen you *do* want to insert a `
    ` break tag using Markdown, you\nend a line with two or more spaces, then type return.\n\nYes, this takes a tad more effort to create a `
    `, but a simplistic\n\"every line break is a `
    `" - "\" rule wouldn't work for Markdown.\nMarkdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]\nwork best -- and look better -- when you format them with hard breaks.\n\n [bq]: #blockquote\n [l]: #list\n\n\n\n

    Headers

    \n\nMarkdown supports two styles of headers, [Setext] [1] and [atx] [2].\n\nSetext-style headers are \"underlined\" using equal signs (for first-level\nheaders) and dashes (for second-level headers). For example:\n\n This is an H1\n =============\n\n This is an H2\n -------------\n\nAny number of underlining `=`'s or `-`" - "'s will work.\n\nAtx-style headers use 1-6 hash characters at the start of the line,\ncorresponding to header levels 1-6. For example:\n\n # This is an H1\n\n ## This is an H2\n\n ###### This is an H6\n\nOptionally, you may \"close\" atx-style headers. This is purely\ncosmetic -- you can use this if you think it looks better. The\nclosing hashes don't even need to match the number of hashes\nused to open the header. (The number of opening hashes\ndetermines the header level.) :\n\n # This is an H1 #\n\n ## This is an H2 ##\n\n ### This is an H3 ######\n\n\n

    Blockquotes

    \n\nMarkdown uses email-style `>` characters for blockquoting. If you're\nfamiliar with quoting passages of text in an email message, then you\nknow how to create a blockquote in Markdown. It looks best if you hard\nwrap the text and put a `>`" - " before every line:\n\n > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\n > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\n > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\n >\n > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\n > id sem consectetuer libero luctus adipiscing.\n\nMarkdown allows you to be lazy and only put the `>` before the first\nline of a hard-wrapped paragraph:\n\n > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\n consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\n Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\n\n > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\n id sem consectetuer libero luctus adipiscing.\n\nBlockquotes can be nested (i.e. a blockquote-in-a-blockquote) by\nadding additional levels of `>`" -- ":\n\n > This is the first level of quoting.\n >\n > > This is nested blockquote.\n >\n > Back to the first level.\n\nBlockquotes can contain other Markdown elements, including headers, lists,\nand code blocks:\n\n\t> ## This is a header.\n\t>\n\t> 1. This is the first list item.\n\t> 2. This is the second list item.\n\t>\n\t> Here's some example code:\n\t>\n\t> return shell_exec(\"echo $input | $markdown_script\");\n\nAny decent text editor should make email-style quoting easy. For\nexample, with BBEdit, you can make a selection and choose Increase\nQuote Level from the Text menu.\n\n\n

    Lists

    \n\nMarkdown supports ordered (numbered) and unordered (bulleted) lists.\n\nUnordered lists use asterisks, pluses, and hyphens -- interchangably\n" -- "-- as list markers:\n\n * Red\n * Green\n * Blue\n\nis equivalent to:\n\n + Red\n + Green\n + Blue\n\nand:\n\n - Red\n - Green\n - Blue\n\nOrdered lists use numbers followed by periods:\n\n 1. Bird\n 2. McHale\n 3. Parish\n\nIt's important to note that the actual numbers you use to mark the\nlist have no effect on the HTML output Markdown produces. The HTML\nMarkdown produces from the above list is:\n\n
      \n
    1. Bird
    2. \n
    3. McHale
    4. \n
    5. Parish
    6. \n
    \n\nIf you instead wrote the list in Markdown like this:\n\n 1. Bird\n 1. McHale\n 1. Parish\n\nor even:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\nyou'd get the exact same HTML output. The point is, if you want to,\nyou can use ordinal numbers in your ordered Markdown lists, so that\nthe numbers in your source match the numbers in your published HTML.\nBut if you want to be lazy, you don't have to.\n\nIf you do use lazy list numbering, however, you should still start the\n" -- "list with the number 1. At some point in the future, Markdown may support\nstarting ordered lists at an arbitrary number.\n\nList markers typically start at the left margin, but may be indented by\nup to three spaces. List markers must be followed by one or more spaces\n" +- ":\n\n > This is the first level of quoting.\n >\n > > This is nested blockquote.\n >\n > Back to the first level.\n\nBlockquotes can contain other Markdown elements, including headers, lists,\nand code blocks:\n\n\t> ## This is a header.\n\t>\n\t> 1. This is the first list item.\n\t> 2. This is the second list item.\n\t>\n\t> Here's some example code:\n\t>\n\t> return shell_exec(\"echo $input | $markdown_script\");\n\nAny decent text editor should make email-style quoting easy. For\nexample, with BBEdit, you can make a selection and choose Increase\nQuote Level from the Text menu.\n\n\n

    Lists

    \n" +- "\nMarkdown supports ordered (numbered) and unordered (bulleted) lists.\n\nUnordered lists use asterisks, pluses, and hyphens -- interchangably\n-- as list markers:\n\n * Red\n * Green\n * Blue\n\nis equivalent to:\n\n + Red\n + Green\n + Blue\n\nand:\n\n - Red\n - Green\n - Blue\n\nOrdered lists use numbers followed by periods:\n\n 1. Bird\n 2. McHale\n 3. Parish\n\nIt's important to note that the actual numbers you use to mark the\nlist have no effect on the HTML output Markdown produces. The HTML\nMarkdown produces from the above list is:\n\n
      \n
    1. Bird
    2. \n
    3. McHale
    4. \n
    5. Parish
    6. \n
    \n\nIf you instead wrote the list in Markdown like this:\n\n 1. Bird\n 1. McHale\n 1. Parish\n\nor even:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\nyou'd get the exact same HTML output. The point is, if you want to,\nyou can use ordinal numbers in your ordered Markdown lists, so that\n" +- "the numbers in your source match the numbers in your published HTML.\nBut if you want to be lazy, you don't have to.\n\nIf you do use lazy list numbering, however, you should still start the\nlist with the number 1. At some point in the future, Markdown may support\nstarting ordered lists at an arbitrary number.\n\nList markers typically start at the left margin, but may be indented by\nup to three spaces. List markers must be followed by one or more spaces\n" - "or a tab.\n\nTo make lists look nice, you can wrap items with hanging indents:\n\n * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\n viverra nec, fringilla in, laoreet vitae, risus.\n * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\n Suspendisse id sem consectetuer libero luctus adipiscing.\n\nBut if you want to be lazy, you don't have to:\n\n * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\n viverra nec, fringilla in, laoreet vitae, risus.\n * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\n Suspendisse id sem consectetuer libero luctus adipiscing.\n\nIf list items are separated by blank lines, Markdown will wrap the\nitems in `

    `" - " tags in the HTML output. For example, this input:\n\n * Bird\n * Magic\n\nwill turn into:\n\n

      \n
    • Bird
    • \n
    • Magic
    • \n
    \n\nBut this:\n\n * Bird\n\n * Magic\n\nwill turn into:\n\n
      \n
    • Bird

    • \n
    • Magic

    • \n
    \n\nList items may consist of multiple paragraphs. Each subsequent\nparagraph in a list item must be indented by either 4 spaces\nor one tab:\n\n 1. This is a list item with two paragraphs. Lorem ipsum dolor\n sit amet, consectetuer adipiscing elit. Aliquam hendrerit\n mi posuere lectus.\n\n Vestibulum enim wisi, viverra nec, fringilla in, laoreet\n vitae, risus. Donec sit amet nisl. Aliquam semper ipsum\n sit amet velit.\n\n 2. Suspendisse id sem consectetuer libero luctus adipiscing.\n\nIt looks nice if you indent every line of the subsequent\nparagraphs, but here again, Markdown will allow you to be\n" -- "lazy:\n\n * This is a list item with two paragraphs.\n\n This is the second paragraph in the list item. You're\n only required to indent the first line. Lorem ipsum dolor\n sit amet, consectetuer adipiscing elit.\n\n * Another item in the same list.\n\nTo put a blockquote within a list item, the blockquote's `>`" -- "\ndelimiters need to be indented:\n\n * A list item with a blockquote:\n\n > This is a blockquote\n > inside a list item.\n\nTo put a code block within a list item, the code block needs\nto be indented *twice* -- 8 spaces or two tabs:\n\n * A list item with a code block:\n\n \n\n\nIt's worth noting that it's possible to trigger an ordered list by\naccident, by writing something like this:\n\n 1986. What a great season.\n\nIn other words, a *number-period-space* sequence at the beginning of a\nline. To avoid this, you can backslash-escape the period:\n\n 1986\\. What a great season.\n\n\n\n

    Code Blocks

    \n\nPre-formatted code blocks are used for writing about programming or\nmarkup source code. Rather than forming normal paragraphs, the lines\nof a code block are interpreted literally. Markdown wraps a code block\nin both `
    ` and ``"
    +- "lazy:\n\n    *   This is a list item with two paragraphs.\n\n        This is the second paragraph in the list item. You're\n    only required to indent the first line. Lorem ipsum dolor\n    sit amet, consectetuer adipiscing elit.\n\n    *   Another item in the same list.\n\nTo put a blockquote within a list item, the blockquote's `>`\ndelimiters need to be indented:\n\n    *   A list item with a blockquote:\n\n        > This is a blockquote\n        > inside a list item.\n\nTo put a code block within a list item, the code block needs\nto be indented *twice* -- 8 spaces or two tabs:\n\n    *   A list item with a code block:\n\n            \n\n\nIt's worth noting that it's possible to trigger an ordered list by\naccident, by writing something like this:\n\n    1986. What a great season.\n\nIn other words, a *number-period-space* sequence at the beginning of a\nline. To avoid this, you can backslash-escape the period:\n\n    1986\\. What a great season.\n\n\n\n

    Code Blocks

    \n" +- "\nPre-formatted code blocks are used for writing about programming or\nmarkup source code. Rather than forming normal paragraphs, the lines\nof a code block are interpreted literally. Markdown wraps a code block\nin both `
    ` and ``"
     - " tags.\n\nTo produce a code block in Markdown, simply indent every line of the\nblock by at least 4 spaces or 1 tab. For example, given this input:\n\n    This is a normal paragraph:\n\n        This is a code block.\n\nMarkdown will generate:\n\n    

    This is a normal paragraph:

    \n\n
    This is a code block.\n    
    \n\nOne level of indentation -- 4 spaces or 1 tab -- is removed from each\nline of the code block. For example, this:\n\n Here is an example of AppleScript:\n\n tell application \"Foo\"\n beep\n end tell\n\nwill turn into:\n\n

    Here is an example of AppleScript:

    \n\n
    tell application \"Foo\"\n        beep\n    end tell\n    
    \n\nA code block continues until it reaches a line that is not indented\n(or the end of the article).\n\nWithin a code block, ampersands (`&`) and angle brackets (`<` and `>`" - ")\nare automatically converted into HTML entities. This makes it very\neasy to include example HTML source code using Markdown -- just paste\nit and indent it, and Markdown will handle the hassle of encoding the\nampersands and angle brackets. For example, this:\n\n
    \n © 2004 Foo Corporation\n
    \n\nwill turn into:\n\n
    <div class=\"footer\">\n        &copy; 2004 Foo Corporation\n    </div>\n    
    \n\nRegular Markdown syntax is not processed within code blocks. E.g.,\nasterisks are just literal asterisks within a code block. This means\nit's also easy to use Markdown to write about Markdown's own syntax.\n\n\n\n

    Horizontal Rules

    \n\nYou can produce a horizontal rule tag (`
    `" - ") by placing three or\nmore hyphens, asterisks, or underscores on a line by themselves. If you\nwish, you may use spaces between the hyphens or asterisks. Each of the\nfollowing lines will produce a horizontal rule:\n\n * * *\n\n ***\n\n *****\n\n - - -\n\n ---------------------------------------\n\n\n* * *\n" -- "\n

    Span Elements

    \n\n

    Links

    \n\nMarkdown supports two style of links: *inline* and *reference*.\n\nIn both styles, the link text is delimited by [square brackets].\n\nTo create an inline link, use a set of regular parentheses immediately\nafter the link text's closing square bracket. Inside the parentheses,\nput the URL where you want the link to point, along with an *optional*\ntitle for the link, surrounded in quotes. For example:\n\n This is [an example](http://example.com/ \"Title\") inline link.\n\n [This link](http://example.net/) has no title attribute.\n\nWill produce:\n\n

    This is \n an example inline link.

    \n\n

    This link has no\n title attribute.

    \n\nIf you're referring to a local resource on the same server, you can\nuse relative paths:\n\n See my [About](/about/) page for details.\n\nReference-style links use a second set of square brackets, inside\n" +- "\n

    Span Elements

    \n\n

    Links

    \n" +- "\nMarkdown supports two style of links: *inline* and *reference*.\n\nIn both styles, the link text is delimited by [square brackets].\n\nTo create an inline link, use a set of regular parentheses immediately\nafter the link text's closing square bracket. Inside the parentheses,\nput the URL where you want the link to point, along with an *optional*\ntitle for the link, surrounded in quotes. For example:\n\n This is [an example](http://example.com/ \"Title\") inline link.\n\n [This link](http://example.net/) has no title attribute.\n\nWill produce:\n\n

    This is \n an example inline link.

    \n\n

    This link has no\n title attribute.

    \n\nIf you're referring to a local resource on the same server, you can\nuse relative paths:\n\n See my [About](/about/) page for details.\n\nReference-style links use a second set of square brackets, inside\n" - "which you place a label of your choosing to identify the link:\n\n This is [an example][id] reference-style link.\n\nYou can optionally use a space to separate the sets of brackets:\n\n This is [an example] [id] reference-style link.\n\nThen, anywhere in the document, you define your link label like this,\non a line by itself:\n\n [id]: http://example.com/ \"Optional Title Here\"\n\nThat is:\n\n* Square brackets containing the link identifier (optionally\n indented from the left margin using up to three spaces);\n* followed by a colon;\n* followed by one or more spaces (or tabs);\n* followed by the URL for the link;\n* optionally followed by a title attribute for the link, enclosed\n" - " in double or single quotes, or enclosed in parentheses.\n\nThe following three link definitions are equivalent:\n\n\t[foo]: http://example.com/ \"Optional Title Here\"\n\t[foo]: http://example.com/ 'Optional Title Here'\n\t[foo]: http://example.com/ (Optional Title Here)\n\n**Note:** There is a known bug in Markdown.pl 1.0.1 which prevents\nsingle quotes from being used to delimit link titles.\n\nThe link URL may, optionally, be surrounded by angle brackets:\n\n [id]: \"Optional Title Here\"\n\nYou can put the title attribute on the next line and use extra spaces\nor tabs for padding, which tends to look better with longer URLs:\n\n [id]: http://example.com/longish/path/to/resource/here\n \"Optional Title Here\"\n\nLink definitions are only used for creating links during Markdown\nprocessing, and are stripped from your document in the HTML output.\n\nLink definition names may consist of letters, numbers, spaces, and\n" - "punctuation -- but they are *not* case sensitive. E.g. these two\nlinks:\n\n\t[link text][a]\n\t[link text][A]\n\nare equivalent.\n\nThe *implicit link name* shortcut allows you to omit the name of the\nlink, in which case the link text itself is used as the name.\nJust use an empty set of square brackets -- e.g., to link the word\n\"Google\" to the google.com web site, you could simply write:\n\n\t[Google][]\n\nAnd then define the link:\n\n\t[Google]: http://google.com/\n\nBecause link names may contain spaces, this shortcut even works for\nmultiple words in the link text:\n\n\tVisit [Daring Fireball][] for more information.\n\nAnd then define the link:\n\n\t[Daring Fireball]: http://daringfireball.net/\n\nLink definitions can be placed anywhere in your Markdown document. I\ntend to put them immediately after each paragraph in which they're\nused, but if you want, you can put them all at the end of your\n" - "document, sort of like footnotes.\n\nHere's an example of reference links in action:\n\n I get 10 times more traffic from [Google] [1] than from\n [Yahoo] [2] or [MSN] [3].\n\n [1]: http://google.com/ \"Google\"\n [2]: http://search.yahoo.com/ \"Yahoo Search\"\n [3]: http://search.msn.com/ \"MSN Search\"\n\nUsing the implicit link name shortcut, you could instead write:\n\n I get 10 times more traffic from [Google][] than from\n [Yahoo][] or [MSN][].\n\n [google]: http://google.com/ \"Google\"\n [yahoo]: http://search.yahoo.com/ \"Yahoo Search\"\n [msn]: http://search.msn.com/ \"MSN Search\"\n\nBoth of the above examples will produce the following HTML output:\n\n

    I get 10 times more traffic from Google than from\n Yahoo\n or MSN.

    \n\n" -- "For comparison, here is the same paragraph written using\nMarkdown's inline link style:\n\n I get 10 times more traffic from [Google](http://google.com/ \"Google\")\n than from [Yahoo](http://search.yahoo.com/ \"Yahoo Search\") or\n [MSN](http://search.msn.com/ \"MSN Search\").\n\nThe point of reference-style links is not that they're easier to\nwrite. The point is that with reference-style links, your document\nsource is vastly more readable. Compare the above examples: using\nreference-style links, the paragraph itself is only 81 characters\nlong; with inline-style links, it's 176 characters; and as raw HTML,\nit's 234 characters. In the raw HTML, there's more markup than there\nis text.\n\nWith Markdown's reference-style links, a source document much more\nclosely resembles the final output, as rendered in a browser. By\nallowing you to move the markup-related metadata out of the paragraph,\nyou can add links without interrupting the narrative flow of your\n" -- "prose.\n\n\n

    Emphasis

    \n\nMarkdown treats asterisks (`*`) and underscores (`_`) as indicators of\nemphasis. Text wrapped with one `*` or `_` will be wrapped with an\nHTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML\n`` tag. E.g., this input:\n\n *single asterisks*\n\n _single underscores_\n\n **double asterisks**\n\n __double underscores__\n\nwill produce:\n\n single asterisks\n\n single underscores\n\n double asterisks\n\n double underscores\n\nYou can use whichever style you prefer; the lone restriction is that\nthe same character must be used to open and close an emphasis span.\n\nEmphasis can be used in the middle of a word:\n\n un*frigging*believable\n\nBut if you surround an `*` or `_`" +- "For comparison, here is the same paragraph written using\nMarkdown's inline link style:\n\n I get 10 times more traffic from [Google](http://google.com/ \"Google\")\n than from [Yahoo](http://search.yahoo.com/ \"Yahoo Search\") or\n [MSN](http://search.msn.com/ \"MSN Search\").\n\nThe point of reference-style links is not that they're easier to\nwrite. The point is that with reference-style links, your document\nsource is vastly more readable. Compare the above examples: using\nreference-style links, the paragraph itself is only 81 characters\nlong; with inline-style links, it's 176 characters; and as raw HTML,\nit's 234 characters. In the raw HTML, there's more markup than there\nis text.\n\nWith Markdown's reference-style links, a source document much more\nclosely resembles the final output, as rendered in a browser. By\nallowing you to move the markup-related metadata out of the paragraph,\nyou can add links without interrupting the narrative flow of your\nprose.\n\n\n

    Emphasis

    \n" +- "\nMarkdown treats asterisks (`*`) and underscores (`_`) as indicators of\nemphasis. Text wrapped with one `*` or `_` will be wrapped with an\nHTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML\n`` tag. E.g., this input:\n\n *single asterisks*\n\n _single underscores_\n\n **double asterisks**\n\n __double underscores__\n\nwill produce:\n\n single asterisks\n\n single underscores\n\n double asterisks\n\n double underscores\n\nYou can use whichever style you prefer; the lone restriction is that\nthe same character must be used to open and close an emphasis span.\n\nEmphasis can be used in the middle of a word:\n\n un*frigging*believable\n\nBut if you surround an `*` or `_`" - " with spaces, it'll be treated as a\nliteral asterisk or underscore.\n\nTo produce a literal asterisk or underscore at a position where it\nwould otherwise be used as an emphasis delimiter, you can backslash\nescape it:\n\n \\*this text is surrounded by literal asterisks\\*\n\n\n\n

    Code

    \n\nTo indicate a span of code, wrap it with backtick quotes (`` ` ``" - ").\nUnlike a pre-formatted code block, a code span indicates code within a\nnormal paragraph. For example:\n\n Use the `printf()` function.\n\nwill produce:\n\n

    Use the printf() function.

    \n\nTo include a literal backtick character within a code span, you can use\nmultiple backticks as the opening and closing delimiters:\n\n ``There is a literal backtick (`) here.``\n\nwhich will produce this:\n\n

    There is a literal backtick (`) here.

    \n\nThe backtick delimiters surrounding a code span may include spaces --\none after the opening, one before the closing. This allows you to place\nliteral backtick characters at the beginning or end of a code span:\n\n\tA single backtick in a code span: `` ` ``\n\n\tA backtick-delimited string in a code span: `` `foo` ``\n\nwill produce:\n\n\t

    A single backtick in a code span: `

    \n\n\t

    A backtick-delimited string in a code span: `foo`

    \n\nWith a code span, ampersands and angle brackets are encoded as HTML\n" - "entities automatically, which makes it easy to include example HTML\ntags. Markdown will turn this:\n\n Please don't use any `` tags.\n\ninto:\n\n

    Please don't use any <blink> tags.

    \n\nYou can write this:\n\n `—` is the decimal-encoded equivalent of `—`.\n\nto produce:\n\n

    &#8212; is the decimal-encoded\n equivalent of &mdash;.

    \n\n\n\n

    Images

    \n\nAdmittedly, it's fairly difficult to devise a \"natural\" syntax for\nplacing images into a plain text document format.\n\nMarkdown uses an image syntax that is intended to resemble the syntax\nfor links, allowing for two styles: *inline* and *reference*.\n\nInline image syntax looks like this:\n\n ![Alt text](/path/to/img.jpg)\n\n ![Alt text](/path/to/img.jpg \"Optional title\")\n\nThat is:\n\n* An exclamation mark: `!`;\n* followed by a set of square brackets, containing the `alt`" - "\n attribute text for the image;\n* followed by a set of parentheses, containing the URL or path to\n the image, and an optional `title` attribute enclosed in double\n or single quotes.\n\nReference-style image syntax looks like this:\n\n ![Alt text][id]\n\nWhere \"id\" is the name of a defined image reference. Image references\nare defined using syntax identical to link references:\n\n [id]: url/to/image \"Optional title attribute\"\n\nAs of this writing, Markdown has no syntax for specifying the\ndimensions of an image; if this is important to you, you can simply\nuse regular HTML `` tags.\n\n\n* * *\n" -- "\n\n

    Miscellaneous

    \n\n

    Automatic Links

    \n\nMarkdown 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:\n\n \n\nMarkdown will turn this into:\n\n http://example.com/\n\nAutomatic links for email addresses work similarly, except that\nMarkdown will also perform a bit of randomized decimal and hex\nentity-encoding to help obscure your address from address-harvesting\n" +- "\n\n

    Miscellaneous

    \n\n

    Automatic Links

    \n" +- "\nMarkdown 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:\n\n \n\nMarkdown will turn this into:\n\n http://example.com/\n\nAutomatic links for email addresses work similarly, except that\nMarkdown will also perform a bit of randomized decimal and hex\nentity-encoding to help obscure your address from address-harvesting\n" - "spambots. For example, Markdown will turn this:\n\n \n\ninto something like this:\n\n address@exa\n mple.com\n\nwhich will render in a browser as a clickable link to \"address@example.com\".\n\n(This sort of entity-encoding trick will indeed fool many, if not\nmost, address-harvesting bots, but it definitely won't fool all of\nthem. It's better than nothing, but an address published in this way\nwill probably eventually start receiving spam.)\n\n\n\n

    Backslash Escapes

    \n\nMarkdown allows you to use backslash escapes to generate literal\ncharacters which would otherwise have special meaning in Markdown's\nformatting syntax. For example, if you wanted to surround a word\nwith literal asterisks (instead of an HTML " - "`` tag), you can use\nbackslashes before the asterisks, like this:\n\n \\*literal asterisks\\*\n\nMarkdown provides backslash escapes for the following characters:\n\n \\ backslash\n ` backtick\n * asterisk\n _ underscore\n {} curly braces\n [] square brackets\n () parentheses\n # hash mark\n\t+\tplus sign\n\t-\tminus sign (hyphen)\n . dot\n ! exclamation mark\n" diff --git a/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md.snap b/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md.snap index 75aadd8..9eea719 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown@markdown_syntax.md.snap @@ -62,7 +62,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "Web Form\">" - Dingus - "\n" -- "\n\n\n" +- "\n" +- "\n\n" - "* [" - "Overview](" - "#overview)" diff --git a/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_basics.md-3.snap b/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_basics.md-3.snap index 43e4574..c08a052 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_basics.md-3.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_basics.md-3.snap @@ -3,9 +3,9 @@ source: tests/text_splitter_snapshots.rs expression: chunks input_file: tests/inputs/markdown/markdown_basics.md --- -- "Markdown: Basics\n================\n\n\n\n\nGetting the Gist of Markdown's Formatting Syntax\n------------------------------------------------\n\nThis page offers a brief overview of what it's like to use Markdown.\nThe [syntax page] [s] provides complete, detailed documentation for\nevery feature, but Markdown should be very easy to pick up simply by\nlooking at a few examples of it in action. The examples on this page\nare written in a before/after style, showing example syntax and the" -- "HTML output produced by Markdown.\n\nIt's also helpful to simply try Markdown out; the [Dingus] [d] is a\nweb application that allows you type your own Markdown-formatted text\nand translate it to XHTML.\n\n**Note:** This document is itself written using Markdown; you\ncan [see the source for it by adding '.text' to the URL] [src].\n\n [s]: /projects/markdown/syntax \"Markdown Syntax\"\n [d]: /projects/markdown/dingus \"Markdown Dingus\"\n [src]: /projects/markdown/basics.text\n\n\n## Paragraphs, Headers, Blockquotes ##\n\nA paragraph is simply one or more consecutive lines of text, separated\nby one or more blank lines. (A blank line is any line that looks like\na blank line -- a line containing nothing but spaces or tabs is\nconsidered blank.) Normal paragraphs should not be indented with\nspaces or tabs.\n\nMarkdown offers two styles of headers: *Setext* and *atx*.\nSetext-style headers for `

    ` and `

    ` are created by\n\"underlining\" with equal signs (`=`) and hyphens (`-`" -- "), respectively.\nTo create an atx-style header, you put 1-6 hash marks (`#`) at the\nbeginning of the line -- the number of hashes equals the resulting\nHTML header level.\n\nBlockquotes are indicated using email-style '`>`" +- "Markdown: Basics\n================\n\n" +- "Getting the Gist of Markdown's Formatting Syntax\n------------------------------------------------\n\nThis page offers a brief overview of what it's like to use Markdown.\nThe [syntax page] [s] provides complete, detailed documentation for\nevery feature, but Markdown should be very easy to pick up simply by\nlooking at a few examples of it in action. The examples on this page\nare written in a before/after style, showing example syntax and the\nHTML output produced by Markdown.\n\nIt's also helpful to simply try Markdown out; the [Dingus] [d] is a\nweb application that allows you type your own Markdown-formatted text\nand translate it to XHTML.\n\n**Note:** This document is itself written using Markdown; you" +- "can [see the source for it by adding '.text' to the URL] [src].\n\n [s]: /projects/markdown/syntax \"Markdown Syntax\"\n [d]: /projects/markdown/dingus \"Markdown Dingus\"\n [src]: /projects/markdown/basics.text\n\n\n## Paragraphs, Headers, Blockquotes ##\n\nA paragraph is simply one or more consecutive lines of text, separated\nby one or more blank lines. (A blank line is any line that looks like\na blank line -- a line containing nothing but spaces or tabs is\nconsidered blank.) Normal paragraphs should not be indented with\nspaces or tabs.\n\nMarkdown offers two styles of headers: *Setext* and *atx*.\nSetext-style headers for `

    ` and `

    ` are created by\n\"underlining\" with equal signs (`=`) and hyphens (`-`), respectively.\nTo create an atx-style header, you put 1-6 hash marks (`#`) at the\nbeginning of the line -- the number of hashes equals the resulting\nHTML header level.\n\nBlockquotes are indicated using email-style '`>`" - "' angle brackets.\n\nMarkdown:\n\n A First Level Header\n ====================\n\n A Second Level Header\n ---------------------\n\n Now is the time for all good men to come to\n the aid of their country. This is just a\n regular paragraph.\n\n The quick brown fox jumped over the lazy\n dog's back.\n\n ### Header 3\n\n > This is a blockquote.\n >\n > This is the second paragraph in the blockquote.\n >\n > ## This is an H2 in a blockquote\n\n\nOutput:\n\n

    A First Level Header

    \n\n

    A Second Level Header

    \n\n

    Now is the time for all good men to come to\n the aid of their country. This is just a\n regular paragraph.

    \n\n

    The quick brown fox jumped over the lazy\n dog's back.

    \n\n

    Header 3

    \n\n
    \n

    This is a blockquote.

    \n\n

    This is the second paragraph in the blockquote.

    \n\n

    This is an H2 in a blockquote

    \n
    \n\n\n\n### Phrase Emphasis ###" - "Markdown uses asterisks and underscores to indicate spans of emphasis.\n\nMarkdown:\n\n Some of these words *are emphasized*.\n Some of these words _are emphasized also_.\n\n Use two asterisks for **strong emphasis**.\n Or, if you prefer, __use two underscores instead__.\n\nOutput:\n\n

    Some of these words are emphasized.\n Some of these words are emphasized also.

    \n\n

    Use two asterisks for strong emphasis.\n Or, if you prefer, use two underscores instead.

    \n\n\n\n## Lists ##\n\nUnordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,\n`+`, and `-`" - ") as list markers. These three markers are\ninterchangable; this:\n\n * Candy.\n * Gum.\n * Booze.\n\nthis:\n\n + Candy.\n + Gum.\n + Booze.\n\nand this:\n\n - Candy.\n - Gum.\n - Booze.\n\nall produce the same output:\n\n
      \n
    • Candy.
    • \n
    • Gum.
    • \n
    • Booze.
    • \n
    \n\nOrdered (numbered) lists use regular numbers, followed by periods, as\nlist markers:\n\n 1. Red\n 2. Green\n 3. Blue\n\nOutput:\n\n
      \n
    1. Red
    2. \n
    3. Green
    4. \n
    5. Blue
    6. \n
    \n\nIf you put blank lines between items, you'll get `

    `" diff --git a/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-2.snap b/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-2.snap index 493247e..657cd79 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-2.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-2.snap @@ -35,8 +35,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "characters, which punctuation characters have been carefully chosen so" - "as to look like what they mean. E.g., asterisks around a word actually" - "look like \\*emphasis\\*. Markdown lists look like, well, lists. Even" -- "blockquotes look like quoted passages of text, assuming you've ever" -- "used email.\n\n\n\n

    Inline HTML

    " +- "blockquotes look like quoted passages of text, assuming you've ever\nused email." +- "

    Inline HTML

    " - "Markdown's syntax is intended for one purpose: to be used as a" - "format for *writing* for the web.\n\nMarkdown is not a replacement for HTML, or even close to it. Its" - "syntax is very small, corresponding only to a very small subset of" @@ -64,8 +64,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "`` or ``" - "tags instead of Markdown's" - "link or image syntax, go right ahead." -- "Unlike block-level HTML tags, Markdown syntax *is* processed within" -- "span-level tags.\n\n\n

    Automatic Escaping for Special Characters

    " +- "Unlike block-level HTML tags, Markdown syntax *is* processed within\nspan-level tags." +- "

    Automatic Escaping for Special Characters

    " - "In HTML, there are two characters that demand special treatment: `<`\nand `&`" - ". Left angle brackets are used to start tags; ampersands are" - used to denote HTML entities. If you want to use them as literal @@ -142,8 +142,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "This is the second list item.\n\t>\n\t> Here's some example code:\n\t>" - "> return shell_exec(\"echo $input | $markdown_script\");" - Any decent text editor should make email-style quoting easy. For -- "example, with BBEdit, you can make a selection and choose Increase" -- "Quote Level from the Text menu.\n\n\n

    Lists

    " +- "example, with BBEdit, you can make a selection and choose Increase\nQuote Level from the Text menu." +- "

    Lists

    " - Markdown supports ordered (numbered) and unordered (bulleted) lists. - "Unordered lists use asterisks, pluses, and hyphens -- interchangably" - "-- as list markers:\n\n * Red\n * Green\n * Blue\n\nis equivalent to:\n\n + Red" @@ -305,8 +305,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "is text.\n\nWith Markdown's reference-style links, a source document much more" - "closely resembles the final output, as rendered in a browser. By" - "allowing you to move the markup-related metadata out of the paragraph," -- you can add links without interrupting the narrative flow of your -- "prose.\n\n\n

    Emphasis

    \n\nMarkdown treats asterisks (`*`) and underscores (`_`" +- "you can add links without interrupting the narrative flow of your\nprose.\n\n\n

    Emphasis

    " +- "Markdown treats asterisks (`*`) and underscores (`_`" - ") as indicators of\nemphasis. Text wrapped with one `*` or `_` will be wrapped with an\nHTML ``" - "tag; double `*`'s or `_`'s will be wrapped with an HTML\n``" - "tag. E.g., this input:\n\n *single asterisks*\n\n _single underscores_\n\n **double asterisks**" @@ -341,7 +341,8 @@ input_file: tests/inputs/markdown/markdown_syntax.md - "

    Please don't use any <blink> tags.

    \n\nYou can write this:" - "`—` is the decimal-encoded equivalent of `—`.\n\nto produce:" - "

    &#8212; is the decimal-encoded\n equivalent of &mdash;.

    " -- "

    Images

    \n\nAdmittedly, it's fairly difficult to devise a \"natural\" syntax for" +- "

    Images

    " +- "Admittedly, it's fairly difficult to devise a \"natural\" syntax for" - placing images into a plain text document format. - Markdown uses an image syntax that is intended to resemble the syntax - "for links, allowing for two styles: *inline* and *reference*.\n\nInline image syntax looks like this:" diff --git a/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-3.snap b/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-3.snap index 88d8594..bcb97f9 100644 --- a/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-3.snap +++ b/tests/snapshots/text_splitter_snapshots__markdown_trim@markdown_syntax.md-3.snap @@ -3,40 +3,44 @@ source: tests/text_splitter_snapshots.rs expression: chunks input_file: tests/inputs/markdown/markdown_syntax.md --- -- "Markdown: Syntax\n================\n\n
    \n\n\n* [Overview](#overview)\n * [Philosophy](#philosophy)\n * [Inline HTML](#html)\n * [Automatic Escaping for Special Characters](#autoescape)\n* [Block Elements](#block)\n * [Paragraphs and Line Breaks](#p)\n * [Headers](#header)\n * [Blockquotes](#blockquote)\n * [Lists](#list)\n * [Code Blocks](#precode)\n * [Horizontal Rules](#hr)\n* [Span Elements](#span)\n * [Links](#link)\n * [Emphasis](#em)\n * [Code](#code)" -- "* [Images](#img)\n* [Miscellaneous](#misc)\n * [Backslash Escapes](#backslash)\n * [Automatic Links](#autolink)\n\n\n**Note:** This document is itself written using Markdown; you\ncan [see the source for it by adding '.text' to the URL][src].\n\n [src]: /projects/markdown/syntax.text\n\n* * *" -- "

    Overview

    \n\n

    Philosophy

    \n\nMarkdown is intended to be as easy-to-read and easy-to-write as is feasible.\n\nReadability, however, is emphasized above all else. A Markdown-formatted\ndocument should be publishable as-is, as plain text, without looking\nlike it's been marked up with tags or formatting instructions. While\nMarkdown's syntax has been influenced by several existing text-to-HTML\nfilters -- including [Setext][1], [atx][2], [Textile][3], [reStructuredText][4],\n[Grutatext][5], and [EtText][6] -- the single biggest source of" -- "inspiration for Markdown's syntax is the format of plain text email.\n\n [1]: http://docutils.sourceforge.net/mirror/setext.html\n [2]: http://www.aaronsw.com/2002/atx/\n [3]: https://web.archive.org/web/20021226035527/http://textism.com/tools/textile/\n [4]: http://docutils.sourceforge.net/rst.html\n [5]: http://www.triptico.com/software/grutatxt.html\n [6]: http://ettext.taint.org/doc/\n\nTo this end, Markdown's syntax is comprised entirely of punctuation\ncharacters, which punctuation characters have been carefully chosen so\nas to look like what they mean. E.g., asterisks around a word actually\nlook like \\*emphasis\\*. Markdown lists look like, well, lists. Even\nblockquotes look like quoted passages of text, assuming you've ever\nused email.\n\n\n\n

    Inline HTML

    \n\nMarkdown's syntax is intended for one purpose: to be used as a\nformat for *writing* for the web.\n\nMarkdown is not a replacement for HTML, or even close to it. Its" -- "syntax is very small, corresponding only to a very small subset of\nHTML tags. The idea is *not* to create a syntax that makes it easier\nto insert HTML tags. In my opinion, HTML tags are already easy to\ninsert. The idea for Markdown is to make it easy to read, write, and\nedit prose. HTML is a *publishing* format; Markdown is a *writing*\nformat. Thus, Markdown's formatting syntax only addresses issues that\ncan be conveyed in plain text.\n\nFor any markup that is not covered by Markdown's syntax, you simply\nuse HTML itself. There's no need to preface it or delimit it to\nindicate that you're switching from Markdown to HTML; you just use\nthe tags.\n\nThe only restrictions are that block-level HTML elements -- e.g. `
    `,\n``, `
    `, `

    `, etc. -- must be separated from surrounding\ncontent by blank lines, and the start and end tags of the block should\nnot be indented with tabs or spaces. Markdown is smart enough not\nto add extra (unwanted) `

    `" -- "tags around HTML block-level tags.\n\nFor example, to add an HTML table to a Markdown article:\n\n This is a regular paragraph.\n\n

    \n \n \n \n
    Foo
    \n\n This is another regular paragraph.\n\nNote that Markdown formatting syntax is not processed within block-level\nHTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an\nHTML block.\n\nSpan-level HTML tags -- e.g. ``, ``, or `` -- can be\nused anywhere in a Markdown paragraph, list item, or header. If you\nwant, you can even use HTML tags instead of Markdown formatting; e.g. if\nyou'd prefer to use HTML `` or `` tags instead of Markdown's\nlink or image syntax, go right ahead.\n\nUnlike block-level HTML tags, Markdown syntax *is* processed within\nspan-level tags.\n\n\n

    Automatic Escaping for Special Characters

    \n\nIn HTML, there are two characters that demand special treatment: `<`\nand `&`" -- ". Left angle brackets are used to start tags; ampersands are\nused to denote HTML entities. If you want to use them as literal\ncharacters, you must escape them as entities, e.g. `<`, and\n`&`.\n\nAmpersands in particular are bedeviling for web writers. If you want to\nwrite about 'AT&T', you need to write '`AT&T`'. You even need to\nescape ampersands within URLs. Thus, if you want to link to:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nyou need to encode the URL as:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nin your anchor tag `href` attribute. Needless to say, this is easy to\nforget, and is probably the single most common source of HTML validation\nerrors in otherwise well-marked-up web sites.\n\nMarkdown allows you to use these characters naturally, taking care of\nall the necessary escaping for you. If you use an ampersand as part of\nan HTML entity, it remains unchanged; otherwise it will be translated\ninto `&`" +- "Markdown: Syntax\n================\n\n
    " +- "* [Overview](#overview)\n * [Philosophy](#philosophy)\n * [Inline HTML](#html)\n * [Automatic Escaping for Special Characters](#autoescape)\n* [Block Elements](#block)\n * [Paragraphs and Line Breaks](#p)\n * [Headers](#header)\n * [Blockquotes](#blockquote)\n * [Lists](#list)\n * [Code Blocks](#precode)\n * [Horizontal Rules](#hr)\n* [Span Elements](#span)\n * [Links](#link)\n * [Emphasis](#em)\n * [Code](#code)\n * [Images](#img)\n* [Miscellaneous](#misc)\n * [Backslash Escapes](#backslash)\n * [Automatic Links](#autolink)\n\n\n**Note:** This document is itself written using Markdown; you\ncan [see the source for it by adding '.text' to the URL][src].\n\n [src]: /projects/markdown/syntax.text\n\n* * *" +- "

    Overview

    \n\n

    Philosophy

    " +- "Markdown is intended to be as easy-to-read and easy-to-write as is feasible.\n\nReadability, however, is emphasized above all else. A Markdown-formatted\ndocument should be publishable as-is, as plain text, without looking\nlike it's been marked up with tags or formatting instructions. While\nMarkdown's syntax has been influenced by several existing text-to-HTML\nfilters -- including [Setext][1], [atx][2], [Textile][3], [reStructuredText][4],\n[Grutatext][5], and [EtText][6] -- the single biggest source of\ninspiration for Markdown's syntax is the format of plain text email.\n\n [1]: http://docutils.sourceforge.net/mirror/setext.html\n [2]: http://www.aaronsw.com/2002/atx/\n [3]: https://web.archive.org/web/20021226035527/http://textism.com/tools/textile/\n [4]: http://docutils.sourceforge.net/rst.html\n [5]: http://www.triptico.com/software/grutatxt.html\n [6]: http://ettext.taint.org/doc/\n\nTo this end, Markdown's syntax is comprised entirely of punctuation" +- "characters, which punctuation characters have been carefully chosen so\nas to look like what they mean. E.g., asterisks around a word actually\nlook like \\*emphasis\\*. Markdown lists look like, well, lists. Even\nblockquotes look like quoted passages of text, assuming you've ever\nused email.\n\n\n\n

    Inline HTML

    " +- "Markdown's syntax is intended for one purpose: to be used as a\nformat for *writing* for the web.\n\nMarkdown is not a replacement for HTML, or even close to it. Its\nsyntax is very small, corresponding only to a very small subset of\nHTML tags. The idea is *not* to create a syntax that makes it easier\nto insert HTML tags. In my opinion, HTML tags are already easy to\ninsert. The idea for Markdown is to make it easy to read, write, and\nedit prose. HTML is a *publishing* format; Markdown is a *writing*\nformat. Thus, Markdown's formatting syntax only addresses issues that\ncan be conveyed in plain text.\n\nFor any markup that is not covered by Markdown's syntax, you simply\nuse HTML itself. There's no need to preface it or delimit it to\nindicate that you're switching from Markdown to HTML; you just use\nthe tags.\n\nThe only restrictions are that block-level HTML elements -- e.g. `
    `,\n``, `
    `, `

    `" +- ", etc. -- must be separated from surrounding\ncontent by blank lines, and the start and end tags of the block should\nnot be indented with tabs or spaces. Markdown is smart enough not\nto add extra (unwanted) `

    ` tags around HTML block-level tags.\n\nFor example, to add an HTML table to a Markdown article:\n\n This is a regular paragraph.\n\n

    \n \n \n \n
    Foo
    \n\n This is another regular paragraph.\n\nNote that Markdown formatting syntax is not processed within block-level\nHTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an\nHTML block.\n\nSpan-level HTML tags -- e.g. ``, ``, or `` -- can be\nused anywhere in a Markdown paragraph, list item, or header. If you\nwant, you can even use HTML tags instead of Markdown formatting; e.g. if\nyou'd prefer to use HTML `` or ``" +- "tags instead of Markdown's\nlink or image syntax, go right ahead.\n\nUnlike block-level HTML tags, Markdown syntax *is* processed within\nspan-level tags.\n\n\n

    Automatic Escaping for Special Characters

    \n\nIn HTML, there are two characters that demand special treatment: `<`\nand `&`. Left angle brackets are used to start tags; ampersands are\nused to denote HTML entities. If you want to use them as literal\ncharacters, you must escape them as entities, e.g. `<`, and\n`&`.\n\nAmpersands in particular are bedeviling for web writers. If you want to\nwrite about 'AT&T', you need to write '`AT&T`'. You even need to\nescape ampersands within URLs. Thus, if you want to link to:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nyou need to encode the URL as:\n\n http://images.google.com/images?num=30&q=larry+bird\n\nin your anchor tag `href`" +- "attribute. Needless to say, this is easy to\nforget, and is probably the single most common source of HTML validation\nerrors in otherwise well-marked-up web sites.\n\nMarkdown allows you to use these characters naturally, taking care of\nall the necessary escaping for you. If you use an ampersand as part of\nan HTML entity, it remains unchanged; otherwise it will be translated\ninto `&`" - ".\n\nSo, if you want to include a copyright symbol in your article, you can write:\n\n ©\n\nand Markdown will leave it alone. But if you write:\n\n AT&T\n\nMarkdown will translate it to:\n\n AT&T\n\nSimilarly, because Markdown supports [inline HTML](#html), if you use\nangle brackets as delimiters for HTML tags, Markdown will treat them as\nsuch. But if you write:\n\n 4 < 5\n\nMarkdown will translate it to:\n\n 4 < 5\n\nHowever, inside Markdown code spans and blocks, angle brackets and\nampersands are *always* encoded automatically. This makes it easy to use\nMarkdown to write about HTML code. (As opposed to raw HTML, which is a\nterrible format for writing about HTML syntax, because every single `<`\nand `&` in your example code needs to be escaped.)\n\n\n* * *" - "

    Block Elements

    \n\n\n

    Paragraphs and Line Breaks

    \n\nA paragraph is simply one or more consecutive lines of text, separated\nby one or more blank lines. (A blank line is any line that looks like a\nblank line -- a line containing nothing but spaces or tabs is considered\nblank.) Normal paragraphs should not be indented with spaces or tabs.\n\nThe implication of the \"one or more consecutive lines of text\" rule is\nthat Markdown supports \"hard-wrapped\" text paragraphs. This differs\nsignificantly from most other text-to-HTML formatters (including Movable\nType's \"Convert Line Breaks\" option) which translate every line break\ncharacter in a paragraph into a `
    ` tag.\n\nWhen you *do* want to insert a `
    ` break tag using Markdown, you\nend a line with two or more spaces, then type return.\n\nYes, this takes a tad more effort to create a `
    `, but a simplistic\n\"every line break is a `
    `" - "\" rule wouldn't work for Markdown.\nMarkdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]\nwork best -- and look better -- when you format them with hard breaks.\n\n [bq]: #blockquote\n [l]: #list\n\n\n\n

    Headers

    \n\nMarkdown supports two styles of headers, [Setext] [1] and [atx] [2].\n\nSetext-style headers are \"underlined\" using equal signs (for first-level\nheaders) and dashes (for second-level headers). For example:\n\n This is an H1\n =============\n\n This is an H2\n -------------\n\nAny number of underlining `=`'s or `-`" - "'s will work.\n\nAtx-style headers use 1-6 hash characters at the start of the line,\ncorresponding to header levels 1-6. For example:\n\n # This is an H1\n\n ## This is an H2\n\n ###### This is an H6\n\nOptionally, you may \"close\" atx-style headers. This is purely\ncosmetic -- you can use this if you think it looks better. The\nclosing hashes don't even need to match the number of hashes\nused to open the header. (The number of opening hashes\ndetermines the header level.) :\n\n # This is an H1 #\n\n ## This is an H2 ##\n\n ### This is an H3 ######\n\n\n

    Blockquotes

    \n\nMarkdown uses email-style `>` characters for blockquoting. If you're\nfamiliar with quoting passages of text in an email message, then you\nknow how to create a blockquote in Markdown. It looks best if you hard\nwrap the text and put a `>`" - "before every line:\n\n > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\n > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\n > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\n >\n > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\n > id sem consectetuer libero luctus adipiscing.\n\nMarkdown allows you to be lazy and only put the `>` before the first\nline of a hard-wrapped paragraph:\n\n > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,\n consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.\n Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.\n\n > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse\n id sem consectetuer libero luctus adipiscing.\n\nBlockquotes can be nested (i.e. a blockquote-in-a-blockquote) by\nadding additional levels of `>`" -- ":\n\n > This is the first level of quoting.\n >\n > > This is nested blockquote.\n >\n > Back to the first level.\n\nBlockquotes can contain other Markdown elements, including headers, lists,\nand code blocks:\n\n\t> ## This is a header.\n\t>\n\t> 1. This is the first list item.\n\t> 2. This is the second list item.\n\t>\n\t> Here's some example code:\n\t>\n\t> return shell_exec(\"echo $input | $markdown_script\");\n\nAny decent text editor should make email-style quoting easy. For\nexample, with BBEdit, you can make a selection and choose Increase\nQuote Level from the Text menu.\n\n\n

    Lists

    \n\nMarkdown supports ordered (numbered) and unordered (bulleted) lists.\n\nUnordered lists use asterisks, pluses, and hyphens -- interchangably" -- "-- as list markers:\n\n * Red\n * Green\n * Blue\n\nis equivalent to:\n\n + Red\n + Green\n + Blue\n\nand:\n\n - Red\n - Green\n - Blue\n\nOrdered lists use numbers followed by periods:\n\n 1. Bird\n 2. McHale\n 3. Parish\n\nIt's important to note that the actual numbers you use to mark the\nlist have no effect on the HTML output Markdown produces. The HTML\nMarkdown produces from the above list is:\n\n
      \n
    1. Bird
    2. \n
    3. McHale
    4. \n
    5. Parish
    6. \n
    \n\nIf you instead wrote the list in Markdown like this:\n\n 1. Bird\n 1. McHale\n 1. Parish\n\nor even:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\nyou'd get the exact same HTML output. The point is, if you want to,\nyou can use ordinal numbers in your ordered Markdown lists, so that\nthe numbers in your source match the numbers in your published HTML.\nBut if you want to be lazy, you don't have to.\n\nIf you do use lazy list numbering, however, you should still start the" -- "list with the number 1. At some point in the future, Markdown may support\nstarting ordered lists at an arbitrary number.\n\nList markers typically start at the left margin, but may be indented by\nup to three spaces. List markers must be followed by one or more spaces" +- ":\n\n > This is the first level of quoting.\n >\n > > This is nested blockquote.\n >\n > Back to the first level.\n\nBlockquotes can contain other Markdown elements, including headers, lists,\nand code blocks:\n\n\t> ## This is a header.\n\t>\n\t> 1. This is the first list item.\n\t> 2. This is the second list item.\n\t>\n\t> Here's some example code:\n\t>\n\t> return shell_exec(\"echo $input | $markdown_script\");\n\nAny decent text editor should make email-style quoting easy. For\nexample, with BBEdit, you can make a selection and choose Increase\nQuote Level from the Text menu.\n\n\n

    Lists

    " +- "Markdown supports ordered (numbered) and unordered (bulleted) lists.\n\nUnordered lists use asterisks, pluses, and hyphens -- interchangably\n-- as list markers:\n\n * Red\n * Green\n * Blue\n\nis equivalent to:\n\n + Red\n + Green\n + Blue\n\nand:\n\n - Red\n - Green\n - Blue\n\nOrdered lists use numbers followed by periods:\n\n 1. Bird\n 2. McHale\n 3. Parish\n\nIt's important to note that the actual numbers you use to mark the\nlist have no effect on the HTML output Markdown produces. The HTML\nMarkdown produces from the above list is:\n\n
      \n
    1. Bird
    2. \n
    3. McHale
    4. \n
    5. Parish
    6. \n
    \n\nIf you instead wrote the list in Markdown like this:\n\n 1. Bird\n 1. McHale\n 1. Parish\n\nor even:\n\n 3. Bird\n 1. McHale\n 8. Parish\n\nyou'd get the exact same HTML output. The point is, if you want to,\nyou can use ordinal numbers in your ordered Markdown lists, so that" +- "the numbers in your source match the numbers in your published HTML.\nBut if you want to be lazy, you don't have to.\n\nIf you do use lazy list numbering, however, you should still start the\nlist with the number 1. At some point in the future, Markdown may support\nstarting ordered lists at an arbitrary number.\n\nList markers typically start at the left margin, but may be indented by\nup to three spaces. List markers must be followed by one or more spaces" - "or a tab.\n\nTo make lists look nice, you can wrap items with hanging indents:\n\n * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\n viverra nec, fringilla in, laoreet vitae, risus.\n * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\n Suspendisse id sem consectetuer libero luctus adipiscing.\n\nBut if you want to be lazy, you don't have to:\n\n * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,\n viverra nec, fringilla in, laoreet vitae, risus.\n * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.\n Suspendisse id sem consectetuer libero luctus adipiscing.\n\nIf list items are separated by blank lines, Markdown will wrap the\nitems in `

    `" - "tags in the HTML output. For example, this input:\n\n * Bird\n * Magic\n\nwill turn into:\n\n

      \n
    • Bird
    • \n
    • Magic
    • \n
    \n\nBut this:\n\n * Bird\n\n * Magic\n\nwill turn into:\n\n
      \n
    • Bird

    • \n
    • Magic

    • \n
    \n\nList items may consist of multiple paragraphs. Each subsequent\nparagraph in a list item must be indented by either 4 spaces\nor one tab:\n\n 1. This is a list item with two paragraphs. Lorem ipsum dolor\n sit amet, consectetuer adipiscing elit. Aliquam hendrerit\n mi posuere lectus.\n\n Vestibulum enim wisi, viverra nec, fringilla in, laoreet\n vitae, risus. Donec sit amet nisl. Aliquam semper ipsum\n sit amet velit.\n\n 2. Suspendisse id sem consectetuer libero luctus adipiscing.\n\nIt looks nice if you indent every line of the subsequent\nparagraphs, but here again, Markdown will allow you to be" -- "lazy:\n\n * This is a list item with two paragraphs.\n\n This is the second paragraph in the list item. You're\n only required to indent the first line. Lorem ipsum dolor\n sit amet, consectetuer adipiscing elit.\n\n * Another item in the same list.\n\nTo put a blockquote within a list item, the blockquote's `>`" -- "delimiters need to be indented:\n\n * A list item with a blockquote:\n\n > This is a blockquote\n > inside a list item.\n\nTo put a code block within a list item, the code block needs\nto be indented *twice* -- 8 spaces or two tabs:\n\n * A list item with a code block:\n\n \n\n\nIt's worth noting that it's possible to trigger an ordered list by\naccident, by writing something like this:\n\n 1986. What a great season.\n\nIn other words, a *number-period-space* sequence at the beginning of a\nline. To avoid this, you can backslash-escape the period:\n\n 1986\\. What a great season.\n\n\n\n

    Code Blocks

    \n\nPre-formatted code blocks are used for writing about programming or\nmarkup source code. Rather than forming normal paragraphs, the lines\nof a code block are interpreted literally. Markdown wraps a code block\nin both `
    ` and ``"
    +- "lazy:\n\n    *   This is a list item with two paragraphs.\n\n        This is the second paragraph in the list item. You're\n    only required to indent the first line. Lorem ipsum dolor\n    sit amet, consectetuer adipiscing elit.\n\n    *   Another item in the same list.\n\nTo put a blockquote within a list item, the blockquote's `>`\ndelimiters need to be indented:\n\n    *   A list item with a blockquote:\n\n        > This is a blockquote\n        > inside a list item.\n\nTo put a code block within a list item, the code block needs\nto be indented *twice* -- 8 spaces or two tabs:\n\n    *   A list item with a code block:\n\n            \n\n\nIt's worth noting that it's possible to trigger an ordered list by\naccident, by writing something like this:\n\n    1986. What a great season.\n\nIn other words, a *number-period-space* sequence at the beginning of a\nline. To avoid this, you can backslash-escape the period:\n\n    1986\\. What a great season.\n\n\n\n

    Code Blocks

    " +- "Pre-formatted code blocks are used for writing about programming or\nmarkup source code. Rather than forming normal paragraphs, the lines\nof a code block are interpreted literally. Markdown wraps a code block\nin both `
    ` and ``"
     - "tags.\n\nTo produce a code block in Markdown, simply indent every line of the\nblock by at least 4 spaces or 1 tab. For example, given this input:\n\n    This is a normal paragraph:\n\n        This is a code block.\n\nMarkdown will generate:\n\n    

    This is a normal paragraph:

    \n\n
    This is a code block.\n    
    \n\nOne level of indentation -- 4 spaces or 1 tab -- is removed from each\nline of the code block. For example, this:\n\n Here is an example of AppleScript:\n\n tell application \"Foo\"\n beep\n end tell\n\nwill turn into:\n\n

    Here is an example of AppleScript:

    \n\n
    tell application \"Foo\"\n        beep\n    end tell\n    
    \n\nA code block continues until it reaches a line that is not indented\n(or the end of the article).\n\nWithin a code block, ampersands (`&`) and angle brackets (`<` and `>`" - ")\nare automatically converted into HTML entities. This makes it very\neasy to include example HTML source code using Markdown -- just paste\nit and indent it, and Markdown will handle the hassle of encoding the\nampersands and angle brackets. For example, this:\n\n
    \n © 2004 Foo Corporation\n
    \n\nwill turn into:\n\n
    <div class=\"footer\">\n        &copy; 2004 Foo Corporation\n    </div>\n    
    \n\nRegular Markdown syntax is not processed within code blocks. E.g.,\nasterisks are just literal asterisks within a code block. This means\nit's also easy to use Markdown to write about Markdown's own syntax.\n\n\n\n

    Horizontal Rules

    \n\nYou can produce a horizontal rule tag (`
    `" - ") by placing three or\nmore hyphens, asterisks, or underscores on a line by themselves. If you\nwish, you may use spaces between the hyphens or asterisks. Each of the\nfollowing lines will produce a horizontal rule:\n\n * * *\n\n ***\n\n *****\n\n - - -\n\n ---------------------------------------\n\n\n* * *" -- "

    Span Elements

    \n\n

    Links

    \n\nMarkdown supports two style of links: *inline* and *reference*.\n\nIn both styles, the link text is delimited by [square brackets].\n\nTo create an inline link, use a set of regular parentheses immediately\nafter the link text's closing square bracket. Inside the parentheses,\nput the URL where you want the link to point, along with an *optional*\ntitle for the link, surrounded in quotes. For example:\n\n This is [an example](http://example.com/ \"Title\") inline link.\n\n [This link](http://example.net/) has no title attribute.\n\nWill produce:\n\n

    This is \n an example inline link.

    \n\n

    This link has no\n title attribute.

    \n\nIf you're referring to a local resource on the same server, you can\nuse relative paths:\n\n See my [About](/about/) page for details.\n\nReference-style links use a second set of square brackets, inside" +- "

    Span Elements

    \n\n

    Links

    " +- "Markdown supports two style of links: *inline* and *reference*.\n\nIn both styles, the link text is delimited by [square brackets].\n\nTo create an inline link, use a set of regular parentheses immediately\nafter the link text's closing square bracket. Inside the parentheses,\nput the URL where you want the link to point, along with an *optional*\ntitle for the link, surrounded in quotes. For example:\n\n This is [an example](http://example.com/ \"Title\") inline link.\n\n [This link](http://example.net/) has no title attribute.\n\nWill produce:\n\n

    This is \n an example inline link.

    \n\n

    This link has no\n title attribute.

    \n\nIf you're referring to a local resource on the same server, you can\nuse relative paths:\n\n See my [About](/about/) page for details.\n\nReference-style links use a second set of square brackets, inside" - "which you place a label of your choosing to identify the link:\n\n This is [an example][id] reference-style link.\n\nYou can optionally use a space to separate the sets of brackets:\n\n This is [an example] [id] reference-style link.\n\nThen, anywhere in the document, you define your link label like this,\non a line by itself:\n\n [id]: http://example.com/ \"Optional Title Here\"\n\nThat is:\n\n* Square brackets containing the link identifier (optionally\n indented from the left margin using up to three spaces);\n* followed by a colon;\n* followed by one or more spaces (or tabs);\n* followed by the URL for the link;\n* optionally followed by a title attribute for the link, enclosed" - "in double or single quotes, or enclosed in parentheses.\n\nThe following three link definitions are equivalent:\n\n\t[foo]: http://example.com/ \"Optional Title Here\"\n\t[foo]: http://example.com/ 'Optional Title Here'\n\t[foo]: http://example.com/ (Optional Title Here)\n\n**Note:** There is a known bug in Markdown.pl 1.0.1 which prevents\nsingle quotes from being used to delimit link titles.\n\nThe link URL may, optionally, be surrounded by angle brackets:\n\n [id]: \"Optional Title Here\"\n\nYou can put the title attribute on the next line and use extra spaces\nor tabs for padding, which tends to look better with longer URLs:\n\n [id]: http://example.com/longish/path/to/resource/here\n \"Optional Title Here\"\n\nLink definitions are only used for creating links during Markdown\nprocessing, and are stripped from your document in the HTML output.\n\nLink definition names may consist of letters, numbers, spaces, and\npunctuation -- but they are *not* case sensitive. E.g. these two" - "links:\n\n\t[link text][a]\n\t[link text][A]\n\nare equivalent.\n\nThe *implicit link name* shortcut allows you to omit the name of the\nlink, in which case the link text itself is used as the name.\nJust use an empty set of square brackets -- e.g., to link the word\n\"Google\" to the google.com web site, you could simply write:\n\n\t[Google][]\n\nAnd then define the link:\n\n\t[Google]: http://google.com/\n\nBecause link names may contain spaces, this shortcut even works for\nmultiple words in the link text:\n\n\tVisit [Daring Fireball][] for more information.\n\nAnd then define the link:\n\n\t[Daring Fireball]: http://daringfireball.net/\n\nLink definitions can be placed anywhere in your Markdown document. I\ntend to put them immediately after each paragraph in which they're\nused, but if you want, you can put them all at the end of your" - "document, sort of like footnotes.\n\nHere's an example of reference links in action:\n\n I get 10 times more traffic from [Google] [1] than from\n [Yahoo] [2] or [MSN] [3].\n\n [1]: http://google.com/ \"Google\"\n [2]: http://search.yahoo.com/ \"Yahoo Search\"\n [3]: http://search.msn.com/ \"MSN Search\"\n\nUsing the implicit link name shortcut, you could instead write:\n\n I get 10 times more traffic from [Google][] than from\n [Yahoo][] or [MSN][].\n\n [google]: http://google.com/ \"Google\"\n [yahoo]: http://search.yahoo.com/ \"Yahoo Search\"\n [msn]: http://search.msn.com/ \"MSN Search\"\n\nBoth of the above examples will produce the following HTML output:\n\n

    I get 10 times more traffic from Google than from\n Yahoo\n or MSN.

    " -- "For comparison, here is the same paragraph written using\nMarkdown's inline link style:\n\n I get 10 times more traffic from [Google](http://google.com/ \"Google\")\n than from [Yahoo](http://search.yahoo.com/ \"Yahoo Search\") or\n [MSN](http://search.msn.com/ \"MSN Search\").\n\nThe point of reference-style links is not that they're easier to\nwrite. The point is that with reference-style links, your document\nsource is vastly more readable. Compare the above examples: using\nreference-style links, the paragraph itself is only 81 characters\nlong; with inline-style links, it's 176 characters; and as raw HTML,\nit's 234 characters. In the raw HTML, there's more markup than there\nis text.\n\nWith Markdown's reference-style links, a source document much more\nclosely resembles the final output, as rendered in a browser. By\nallowing you to move the markup-related metadata out of the paragraph,\nyou can add links without interrupting the narrative flow of your" -- "prose.\n\n\n

    Emphasis

    \n\nMarkdown treats asterisks (`*`) and underscores (`_`) as indicators of\nemphasis. Text wrapped with one `*` or `_` will be wrapped with an\nHTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML\n`` tag. E.g., this input:\n\n *single asterisks*\n\n _single underscores_\n\n **double asterisks**\n\n __double underscores__\n\nwill produce:\n\n single asterisks\n\n single underscores\n\n double asterisks\n\n double underscores\n\nYou can use whichever style you prefer; the lone restriction is that\nthe same character must be used to open and close an emphasis span.\n\nEmphasis can be used in the middle of a word:\n\n un*frigging*believable\n\nBut if you surround an `*` or `_`" +- "For comparison, here is the same paragraph written using\nMarkdown's inline link style:\n\n I get 10 times more traffic from [Google](http://google.com/ \"Google\")\n than from [Yahoo](http://search.yahoo.com/ \"Yahoo Search\") or\n [MSN](http://search.msn.com/ \"MSN Search\").\n\nThe point of reference-style links is not that they're easier to\nwrite. The point is that with reference-style links, your document\nsource is vastly more readable. Compare the above examples: using\nreference-style links, the paragraph itself is only 81 characters\nlong; with inline-style links, it's 176 characters; and as raw HTML,\nit's 234 characters. In the raw HTML, there's more markup than there\nis text.\n\nWith Markdown's reference-style links, a source document much more\nclosely resembles the final output, as rendered in a browser. By\nallowing you to move the markup-related metadata out of the paragraph,\nyou can add links without interrupting the narrative flow of your\nprose.\n\n\n

    Emphasis

    " +- "Markdown treats asterisks (`*`) and underscores (`_`) as indicators of\nemphasis. Text wrapped with one `*` or `_` will be wrapped with an\nHTML `` tag; double `*`'s or `_`'s will be wrapped with an HTML\n`` tag. E.g., this input:\n\n *single asterisks*\n\n _single underscores_\n\n **double asterisks**\n\n __double underscores__\n\nwill produce:\n\n single asterisks\n\n single underscores\n\n double asterisks\n\n double underscores\n\nYou can use whichever style you prefer; the lone restriction is that\nthe same character must be used to open and close an emphasis span.\n\nEmphasis can be used in the middle of a word:\n\n un*frigging*believable\n\nBut if you surround an `*` or `_`" - "with spaces, it'll be treated as a\nliteral asterisk or underscore.\n\nTo produce a literal asterisk or underscore at a position where it\nwould otherwise be used as an emphasis delimiter, you can backslash\nescape it:\n\n \\*this text is surrounded by literal asterisks\\*\n\n\n\n

    Code

    \n\nTo indicate a span of code, wrap it with backtick quotes (`` ` ``" - ").\nUnlike a pre-formatted code block, a code span indicates code within a\nnormal paragraph. For example:\n\n Use the `printf()` function.\n\nwill produce:\n\n

    Use the printf() function.

    \n\nTo include a literal backtick character within a code span, you can use\nmultiple backticks as the opening and closing delimiters:\n\n ``There is a literal backtick (`) here.``\n\nwhich will produce this:\n\n

    There is a literal backtick (`) here.

    \n\nThe backtick delimiters surrounding a code span may include spaces --\none after the opening, one before the closing. This allows you to place\nliteral backtick characters at the beginning or end of a code span:\n\n\tA single backtick in a code span: `` ` ``\n\n\tA backtick-delimited string in a code span: `` `foo` ``\n\nwill produce:\n\n\t

    A single backtick in a code span: `

    \n\n\t

    A backtick-delimited string in a code span: `foo`

    \n\nWith a code span, ampersands and angle brackets are encoded as HTML" - "entities automatically, which makes it easy to include example HTML\ntags. Markdown will turn this:\n\n Please don't use any `` tags.\n\ninto:\n\n

    Please don't use any <blink> tags.

    \n\nYou can write this:\n\n `—` is the decimal-encoded equivalent of `—`.\n\nto produce:\n\n

    &#8212; is the decimal-encoded\n equivalent of &mdash;.

    \n\n\n\n

    Images

    \n\nAdmittedly, it's fairly difficult to devise a \"natural\" syntax for\nplacing images into a plain text document format.\n\nMarkdown uses an image syntax that is intended to resemble the syntax\nfor links, allowing for two styles: *inline* and *reference*.\n\nInline image syntax looks like this:\n\n ![Alt text](/path/to/img.jpg)\n\n ![Alt text](/path/to/img.jpg \"Optional title\")\n\nThat is:\n\n* An exclamation mark: `!`;\n* followed by a set of square brackets, containing the `alt`" - "attribute text for the image;\n* followed by a set of parentheses, containing the URL or path to\n the image, and an optional `title` attribute enclosed in double\n or single quotes.\n\nReference-style image syntax looks like this:\n\n ![Alt text][id]\n\nWhere \"id\" is the name of a defined image reference. Image references\nare defined using syntax identical to link references:\n\n [id]: url/to/image \"Optional title attribute\"\n\nAs of this writing, Markdown has no syntax for specifying the\ndimensions of an image; if this is important to you, you can simply\nuse regular HTML `` tags.\n\n\n* * *" -- "

    Miscellaneous

    \n\n

    Automatic Links

    \n\nMarkdown 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:\n\n \n\nMarkdown will turn this into:\n\n http://example.com/\n\nAutomatic links for email addresses work similarly, except that\nMarkdown will also perform a bit of randomized decimal and hex\nentity-encoding to help obscure your address from address-harvesting" +- "

    Miscellaneous

    \n\n

    Automatic Links

    " +- "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:\n\n \n\nMarkdown will turn this into:\n\n http://example.com/\n\nAutomatic links for email addresses work similarly, except that\nMarkdown will also perform a bit of randomized decimal and hex\nentity-encoding to help obscure your address from address-harvesting" - "spambots. For example, Markdown will turn this:\n\n \n\ninto something like this:\n\n address@exa\n mple.com\n\nwhich will render in a browser as a clickable link to \"address@example.com\".\n\n(This sort of entity-encoding trick will indeed fool many, if not\nmost, address-harvesting bots, but it definitely won't fool all of\nthem. It's better than nothing, but an address published in this way\nwill probably eventually start receiving spam.)\n\n\n\n

    Backslash Escapes

    \n\nMarkdown allows you to use backslash escapes to generate literal\ncharacters which would otherwise have special meaning in Markdown's\nformatting syntax. For example, if you wanted to surround a word\nwith literal asterisks (instead of an HTML" - "`` tag), you can use\nbackslashes before the asterisks, like this:\n\n \\*literal asterisks\\*\n\nMarkdown provides backslash escapes for the following characters:\n\n \\ backslash\n ` backtick\n * asterisk\n _ underscore\n {} curly braces\n [] square brackets\n () parentheses\n # hash mark\n\t+\tplus sign\n\t-\tminus sign (hyphen)\n . dot\n ! exclamation mark"