Markdown

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz allowing people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)".[1] The language takes many cues from existing conventions for marking up plain text in email.

Markdown is also a Perl script written by Gruber, Markdown.pl, which converts marked-up text input to valid, well-formed XHTML or HTML and replaces left-pointing angle brackets ('<') and ampersands with their corresponding character entity references. It can be used a a standalone script, as a plugin for Blosxom or Movable Type, or as a text filter for BBEdit.[1]

Markdown has since been re-implemented by others as a Perl module available on CPAN (Text::Markdown), and in a variety of other programming languages. It is distributed under a BSD-style license and is included with, or available as a plugin for, several content-management systems.[2][3]

Contents

[edit] Syntax examples

This is not an exhaustive listing of Markdown's syntax, and in many cases multiple styles of syntax are available to accomplish a particular effect. See the full Markdown syntax for more information. Characters which are ordinarily interpreted by Markdown as formatting commands will instead be interpreted literally if preceded by a backslash; for example, the sequence '\*' would output an asterisk rather than beginning a span of emphasized text. Markdown also does not transform any text within a "raw" block-level XHTML element; thus it is possible to include sections of XHTML within a Markdown source document by wrapping them in block-level XHTML tags.

[edit] Paragraphs

A paragraph is one or more consecutive lines of text separated by one or more blank lines. Normal paragraphs should not be indented with spaces or tabs:

This is a paragraph. It has two sentences.

This is another paragraph. It also has two sentences.

[edit] Line return

Line breaks inserted in the text are removed from the final result: the web browser is in charge of breaking lines depending on the available space. To force a line break, insert two spaces at the end of the line.

[edit] Emphasized text

*emphasis* or _emphasis_ (more common)  (e.g., italics)
**strong emphasis** (more common) or __strong emphasis__ (e.g., boldface)

[edit] Code

To include code (formatted in monospace font), you can either :

Some text with `some code` inside
    line 1 of code
    line 2 of code
    line 3 of code

which prevents Markdown from removing all whitespaces, breaking indentation and code layout.

[edit] Lists

* An item in a bulleted (unordered) list
    * A subitem, indented with 4 spaces
* Another item in a bulleted list
1. An item in an enumerated (ordered) list
2. Another item in an enumerated list

[edit] Headings

HTML headings are produced by placing a number of hashes before the header text corresponding to the level of heading desired (HTML offers six levels of headings), like so:

# First-level heading
#### Fourth-level heading

The first two heading levels also have an alternate syntax:

First-level heading
===================

Second-level heading
--------------------

[edit] Blockquotes

> This text will be enclosed in an HTML blockquote element.
> Blockquote elements are reflowable. You may arbitrarily
> wrap the text to your liking, and it will all be parsed
> into a single blockquote element.

The above would translate into the following HTML:

<blockquote><p>This text will be enclosed in an HTML blockquote element. Blockquote
elements are reflowable. You may arbitrarily wrap the text to your liking, and it will all
be parsed into a single blockquote element.</p></blockquote>

[edit] Links

Links may be included inline:

[link text here](link.address.here "link title here")

Alternatively, links can be placed in footnotes outside of the paragraph, being referenced with some sort of reference tag. For example, including the following inline:

[link text here][linkref]

would produce a link if the following showed up outside of the paragraph (or at the end of the document):

[linkref]: link.address.here "link title here"

[edit] Images

Referring to images is similar to including links. The syntax requires an exclamation point to indicate the link refers to an image.

The image address may be included inline, as with links:

![Alt text here](Image URL here "Image title here")

It may also be referred to via a reference:

![Alt text here][imageref]

Here, imageref refers to information somewhere after the image:

[imageref]: image.url.here "Image title here"

[edit] Horizontal rules

Horizontal rules are created by placing three or more hyphens, asterisks, or underscores on a line by themselves. You may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:

* * *
***
*****
- - -
---------------------------------------

[edit] Markdown users

[edit] See also

[edit] References

  1. ^ a b Markdown 1.0.1 readme source code "Daring Fireball - Markdown". 17-Dec-2004. http://daringfireball.net/projects/markdown/. 
  2. ^ "MarsEdit 2.3 ties the knot with Tumblr support - Ars Technica". http://arstechnica.com/apple/news/2009/03/marsedit-23-ties-the-knot-with-tumblr-support.ars. Retrieved 2009-08-11. 
  3. ^ "Review: Practical Django Projects - Ars Technica". http://arstechnica.com/open-source/news/2008/07/review-practical-django-projects.ars. Retrieved 2009-08-11. 
  4. ^ "Markdown Editing Help - Stack Overflow". http://stackoverflow.com/editing-help. Retrieved 2010-04-29. 
  5. ^ "Three Markdown Gotchas - Blog – Stack Overflow". http://blog.stackoverflow.com/2008/06/three-markdown-gotcha/. Retrieved 2010-04-29. 
  6. ^ "Markdown - Posterous Help". http://posterous.com/help/markdown. Retrieved 2010-06-26. 
  7. ^ "Reddit's help document on Markdown". http://www.reddit.com/help/commenting. Retrieved 2010-07-20. 
  8. ^ "Making GitHub More Open: Git-backed Wikis - GitHub". http://github.com/blog/699-making-github-more-open-git-backed-wikis. Retrieved 2010-09-01. 
  9. ^ "GitHub Flavored Markdown - Introduction". http://github.github.com/github-flavored-markdown/. Retrieved 2011-01-03. 
  10. ^ "Daring Fireball Linked List: GitHub Flavored Markdown". http://daringfireball.net/linked/2009/10/23/github-flavored-markdown. Retrieved 2011-01-03. 
  11. ^ "Displaying README Text on your Bitbucket Source Tab". http://confluence.atlassian.com/display/BITBUCKET/Displaying+README+Text+on+your+Bitbucket+Source+Tab. Retrieved 2010-10-01. 
  12. ^ "Markup Choices in Instiki". http://golem.ph.utexas.edu/wiki/instiki/show/Markup+Choices. Retrieved 2010-08-24. 
  13. ^ "Squarespace Mini-Reference". http://www.squarespace.com/display/ShowHelp?section=Markdown. Retrieved 2010-09-30. 
  14. ^ "Tumblr Preferences". http://www.tumblr.com/preferences. Retrieved 2011-01-03. 
  15. ^ "5.0.0 Cerberus Helpdesk Wiki". http://wiki.cerb5.com/wiki/5.0.0#Highlights_of_5.0. Retrieved 2011-01-23. 
  16. ^ "Podmedics Markdown Tutorial". http://www.youtube.com/watch?v=6A5EpqqDOdk. Retrieved 2011-02-13. 
  17. ^ "WordPress Plugins". http://wordpress.org/extend/plugins/about/. Retrieved 2011-02-14. 

[edit] External links

[edit] Alternate implementations

Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages