Markdown
Encyclopedia
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
)". 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 ampersand
s with their corresponding character entity references. It can be used as a standalone script, as a plugin for Blosxom
or Movable Type
, or as a text filter for BBEdit
.
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
.
**strong emphasis** (more common) or __strong emphasis__ (e.g., boldface)
surround inline code with backticks (`), like in
Some text with `some code` inside,
or indent several lines of code by at least four spaces, as in:
The latter option makes Markdown retain all whitespace—as opposed
to the usual behaviour, which, by removing line breaks and excess
spaces, would break indentation and code layout.
* 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
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 alternative syntax:
Lightweight markup language
A lightweight markup language is a markup language with a simple syntax, designed to be easy for a human to enter with a simple text editor, and easy to read in its raw form....
, originally created by John Gruber
John Gruber
John Gruber is a writer from the greater Philadelphia, Pennsylvania area of the USA. Gruber received his Bachelor of Science in computer science from Drexel University. He worked for Bare Bones Software from 2000 to 2002 and Joyent from 2005 to 2006...
and Aaron Swartz
Aaron Swartz
Aaron Swartz is an American programmer, writer, political organizer and Internet activist. He is best known in programming circles for co-authoring the RSS 1.0 specification...
allowing people "to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML
XHTML
XHTML is a family of XML markup languages that mirror or extend versions of the widely-used Hypertext Markup Language , the language in which web pages are written....
(or HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
)". The language takes many cues from existing conventions
Convention (norm)
A convention is a set of agreed, stipulated or generally accepted standards, norms, social norms or criteria, often taking the form of a custom....
for marking up plain text
Plain text
In computing, plain text is the contents of an ordinary sequential file readable as textual material without much processing, usually opposed to formatted text....
in email
Email
Electronic mail, commonly known as email or e-mail, is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer networks. Some early email systems required that the author and the recipient both be online at the...
.
Markdown is also a Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
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 ampersand
Ampersand
An ampersand is a logogram representing the conjunction word "and". The symbol is a ligature of the letters in et, Latin for "and".-Etymology:...
s with their corresponding character entity references. It can be used as a standalone script, as a plugin for Blosxom
Blosxom
Blosxom is a free-software weblog program written in Perl by Rael Dornfest. It uses the pre-existing file system instead of a database management system, unlike most blog software....
or Movable Type
Movable Type
Movable Type is a weblog publishing system developed by the company Six Apart. It was publicly announced on September 3, 2001; version 1.0 was publicly released on October 8, 2001. On 12 December 2007, Movable Type was relicensed as free software under the GNU General Public License...
, or as a text filter for BBEdit
BBEdit
BBEdit is a proprietary text editor made by Bare Bones Software. It was originally developed for Macintosh System Software 6 and is now available for Mac OS X.BBEdit is marketed under the trademark slogan, "It doesn't suck."-History:...
.
Markdown has since been re-implemented by others as a Perl module
Modular programming
Modular programming is a software design technique that increases the extent to which software is composed of separate, interchangeable components called modules by breaking down program functions into modules, each of which accomplishes one function and contains everything necessary to accomplish...
available on CPAN
CPAN
CPAN, the Comprehensive Perl Archive Network, is an archive of nearly 100,000 modules of software written in Perl, as well as documentation for it. It has a presence on the World Wide Web at and is mirrored worldwide at more than 200 locations...
(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
Content management system
A content management system is a system providing a collection of procedures used to manage work flow in a collaborative environment. These procedures can be manual or computer-based...
.
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.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.
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.Emphasized text
*emphasis* or _emphasis_ (more common) (e.g., italics)**strong emphasis** (more common) or __strong emphasis__ (e.g., boldface)
Code
To include code (formatted in monospace font), you can eithersurround inline code with backticks (`), like in
Some text with `some code` inside,
or indent several lines of code by at least four spaces, as in:
line 1 of code
line 2 of code
line 3 of code
The latter option makes Markdown retain all whitespace—as opposed
to the usual behaviour, which, by removing line breaks and excess
spaces, would break indentation and code layout.
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
Headings
HTML headings are produced by placing a number of hashesNumber sign
Number sign is a name for the symbol #, which is used for a variety of purposes including, in some countries, the designation of a number...
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 alternative syntax:
First-level heading
Blockquotes
> "This entire paragraph of 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:
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"
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:
* * *
***
*****
- - -
---------------------------------------
Markdown users
- BitbucketBitbucketBitbucket is a web-based hosting service for projects that use either the Mercurial or Git revision control systems. Bitbucket offers both commercial plans and free accounts...
offers Markdown as an option for markup in project's README. - DIASPORA*Diaspora (social network)Diaspora is a non-profit, user-owned, distributed social network that is based upon the free Diaspora software. As of November 2011, there are more than 200 thousand users connected to the biggest server...
uses Markdown to format user posts, comments and conversations . - DrupalDrupalDrupal is a free and open-source content management system and content management framework written in PHP and distributed under the GNU General Public License. It is used as a back-end system for at least 1.5% of all websites worldwide ranging from personal blogs to corporate, political, and...
has a Markdown add-on, initiated in 2008. As of November 2011 it in use on over 8000 Drupal sites world-wide. - GitHubGithubGitHub is a web-based hosting service for software development projects that use the Git revision control system. GitHub offers both commercial plans and free accounts for open source projects...
uses a dialect of Markdown for formatting comments, messages, etc. John Gruber has described this dialect as a "superior variant" for "situations like user-submitted comments". - G+ Tweaks v1.1151, a Greasemonkey user script for adding functionality to Google's G+ social networking site.
- InstikiInstikiInstiki is wiki software that runs on Ruby on Rails.- Features :* Regular expression search* Revisions* Export to HTML in a zip* RSS feeds* Multiple webs* Password-protected site* Reference tracker* Textile and Markdown formatting...
uses a Markdown extension to wikiWikiA wiki is a website that allows the creation and editing of any number of interlinked web pages via a web browser using a simplified markup language or a WYSIWYG text editor. Wikis are typically powered by wiki software and are often used collaboratively by multiple users. Examples include...
syntax. The extended syntax is called Maruku. - PosterousPosterousPosterous is a simple blogging platform started in May 2008, funded by Y Combinator. It is based in San Francisco.Updating to Posterous is similar to other blogging platforms. Posting can be done by logging in to the website's rich text editor, but it is particularly designed for mobile blogging...
offers Markdown as a markup option. - RedditRedditreddit is a social news website where the registered users submit content, in the form of either a link or a text "self" post. Other users then vote the submission "up" or "down," which is used to rank the post and determine its position on the site's pages and front page.Reddit was originally...
uses Markdown. - Showoff uses Markdown to format slides of a presentation.
- SquarespaceSquarespaceSquarespace is a web publishing company that sells a software publishing platform and file server service to individuals and businesses, providing them the tools and assistance to create and maintain well-designed websites...
offers Markdown as a blog entry option. - Stack OverflowStack overflowIn software, a stack overflow occurs when too much memory is used on the call stack. The call stack contains a limited amount of memory, often determined at the start of the program. The size of the call stack depends on many factors, including the programming language, machine architecture,...
and other Stack Exchange NetworkStack Exchange NetworkThe Stack Exchange Network is a network of websites featuring questions and answers on a wide range of topics in different fields, owned and operated by Stack Exchange, Inc....
sites use a modified dialect of Markdown as its default formatting system. - TumblrTumblrTumblr is a website and microblogging platform that allows users to post text, images, videos, links, quotes and audio to their tumblelog, a short-form blog. Users can follow other users, or choose to make their tumblelog private. The service emphasizes ease of use. The site ranks as the 10th...
allows Markdown edits to posts. - The WordPressWordPressWordPress is a free and open source blogging tool and publishing platform powered by PHP and MySQL. It is often customized into a content management system . It has many features including a plug-in architecture and a template system. WordPress is used by over 14.7% of Alexa Internet's "top 1...
plugin system utilizes a dialect of Markdown in "readme.txt" files submitted by developers, and has plugins for Markdown.
See also
- Markdown extensionsMarkdown extensionsA number of lightweight markup languages extend Markdown by implementing added features not available with plain Markdown syntax...
- reStructuredTextReStructuredTextreStructuredText is a lightweight markup language intended to be highly readable in source format. Its formal name indicates that it is a "revised, reworked, and reinterpreted StructuredText."...
is a similar lightweight markup. - TextileTextile (markup language)Textile is a lightweight markup language originally developed by Dean Allen and billed as a "humane Web text generator". Textile converts its marked-up text input to valid, well-formed XHTML and also inserts character entity references for apostrophes, opening and closing single and double...
, a similar lightweight markup - Markdown ExtraMarkdown ExtraMarkdown Extra is a lightweight markup language based on Markdown, which implements some added features currently not available with plain Markdown syntax.It adds the following features to Markdown:* Inline HTML...
is based upon Markdown but extends its capabilities. - MultiMarkdownMultiMarkdownMultiMarkdown is a lightweight markup language created by Fletcher S. Penney and based on Markdown, which supports more export-formats and implements some added features currently not available with plain Markdown syntax....
is another improved Markdown with more syntax-features and export-options than traditional Markdown. - AsciidocAsciiDocAsciiDoc is a lightweight markup language. It requires the installation of a special AsciiDoc "converter program" that can convert AsciiDoc documents to XHTML, DocBook or HTML. DocBook in turn can be converted to other formats such as PDF, TeX, Unix manpages and many more using the tool A2X which...
another lightweight markup supporting many types of document.
External links
- Official Markdown project at Daring Fireball
- Markdown Wiki
- Introduction to Markdown (tutorial)
- Older Markdown Wiki
- MultiMarkdown (Improved Markdown with more syntax-features and export-options than traditional Markdown)
Alternate implementations
- MarkdownSharp, a slightly modified C# implementation of the Markdown markup language. Developed and used by Stack Overflow.
- PHP Markdown
- Discount, a C implementation of the Markdown markup language
- WMD, a Javascript "WYSIWYM" editor for Markdown (from AttackLab)
- uedit, a Javascript "WYSIWYM" editor for Markdown
- Markdownr.com, a simple website to preview markdown in real time
- BlueCloth, an implementation of Markdown in Ruby
- MarkdownPapers, Java implementation based on a JavaCC parser
- pegdown, a pure-Java Markdown implementation based on a PEGParsing expression grammarA parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language...
parser - Knockoff, a Markdown implementation written in Scala using Parser CombinatorParser CombinatorIn functional programming, a parser combinator is a higher-order function which accepts several parsers as input and returns a new parser as its output. In this context, a parser is a function accepting strings as input and returning some structure as output, typically a parse tree or a set of...
s - Actuarius, another Markdown implementation written in Scala using Parser CombinatorParser CombinatorIn functional programming, a parser combinator is a higher-order function which accepts several parsers as input and returns a new parser as its output. In this context, a parser is a function accepting strings as input and returning some structure as output, typically a parse tree or a set of...
s - Pandoc, a universal document converter
- Txtmark, another Markdown implementation written in JavaJavaJava is an island of Indonesia. With a population of 135 million , it is the world's most populous island, and one of the most densely populated regions in the world. It is home to 60% of Indonesia's population. The Indonesian capital city, Jakarta, is in west Java...
- Markdown in Python, A Python implementation of Markdown
- Blackfriday, another Markdown implementation written in GoGo (programming language)Go is a compiled, garbage-collected, concurrent programming language developed by Google Inc.The initial design of Go was started in September 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. Go was officially announced in November 2009. In May 2010, Rob Pike publicly stated that Go was being...
- Markdown Viewer for PHP, allows viewing the of a Mardown doc via a local PHP server (a wrapper for PHP Markdown)
- MarkdownPad, a full-featured Markdown editor for Windows.