Markdown is a plain text formatting syntax designed so that it can be converted to HTML using a tool by the same name. Markdown is often used to format readme files, for writing messages in online discussion forums, and to create rich text using a plain text editor.
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 ampersands 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.
This wiki entry was copied from Wikipedia.
Formatting using markdown
Different markdown dialects use slightly different formatting, but here are the general ideas:
You can use **
or __
to start and end bold text.
**Danger:** you need to prepare user inputs to avoid SQL injection.
You can use *
or _
to start and end italic text.
_A Christmas Carol_ is a book written by Charles Dickens.
You can use backticks to format code
text.
An `if` statement checks a condition, and runs code if it is true.
You can use ```
to format entire code blocks (like the one below)
Here is some code:
```
for (i = 0; i < 10; i++) {
print "hi";
}
```
You can use >
at the start of a line to insert a quote.
The specification says:
> You need to put x and y in brackets
Markdown dialects
A number of Markdown dialects are in widespread use, most of which add or enhance support for things like tables and links. Notable examples include
- github-flavored-markdown - GitHub Flavored Markdown (GFM)
- multimarkdown - MultiMarkdown
- Pandoc Extended Markdown
Babelmark may be used to compare the output generated by different implementations of Markdown.
Since 2014, you also have CommonMark, a strongly defined, highly compatible specification of Markdown (see "Standard Markdown is now Common Markdown").