forked from hypernumbers/erlmarkdown
/
syntax.txt
1 lines (1 loc) · 7.1 KB
/
syntax.txt
1
"\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<h2 id=\"overview\">Overview</h2>\n\n<h3 id=\"philosophy\">Philosophy</h3>\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]: 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<h3 id=\"html\">Inline HTML</h3>\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. `<div>`,\n`<table>`, `<pre>`, `<p>`, 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) `<p>` 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 <table>\n <tr>\n <td>Foo</td>\n </tr>\n </table>\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. `<span>`, `<cite>`, or `<del>` -- 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 `<a>` or `<img>` 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<h3 id=\"autoescape\">Automatic Escaping for Special Characters</h3>\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<h2 id=\"block\">Block Elements</h2>\n\n\n<h3 id=\"p\">Paragraphs and Line Breaks</h3>\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 `<br />` tag.\n\nWhen you *do* want to insert a `<br />` 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 `<br />`, but a simplistic\n\"every line break is a `<br />`\" 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"