Markdown Syntax

I. What is Markdown

Targets of Markdown

Markdown is a text-to-HTML conversion tool for web writers by John Gruber @Daringfireball. Thus other details can be seen in author’s website above.

Tools for Markdown

Most people recommend Mou on Mac OS. While on Windows, here are MarkdownPad (much better than the followings …) and MarkPad (er… it’s too slow at least for me). For convenience, I just use Atom by Google with MD plugin, it’s enough for me.

II. Markdown Syntax

Headers

1
2
3
# This is an H1
## This is an H2
###### This is an H6

There are 6 levels of header, adding # , from H1 to H6.

Lists

Markdown supports ordered (numbered) and unordered (bulleted) lists.

unordered

1
2
3
*   Red
* Green
* Blue

is equivalent to:

1
2
3
-   Red
- Green
- Blue

numbered

1
2
3
1.  Bird
2. McHale
3. Parish

Quotes

Markdown allows you to be lazy and only put the > before the first line of a hard-wrapped paragraph:

1
2
3
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

shown as,

This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.

This style is based on the template used in Hexo.

Markdown supports two style of links and images: inline and reference.

inline

1
2
3
4
5
6
7
links : This is [an example](http://example.com/ "Title") inline link.
or
[This link](http://example.net/) has no title attribute.

images : ![Alt text](/path/to/img.jpg)
or
![Alt text](/path/to/img.jpg "Optional title")

If you’re referring to a local resource on the same server, you can use relative paths:

1
See my [About](/about/) page for details.

reference

1
2
3
4
5
6
7
links: This is [an example] [id] reference-style link.
where id is defined by
[id]: http://example.com/ "Optional Title Here"

images: ![Alt text][id]
where id is defined by
[id]: url/to/image "Optional title attribute"

Code

To indicate a span of code, wrap it with backtick quotes `.

1
Use the `printf()` function.

Emphasis

Markdown treats asterisks () and underscores (_) as indicators of emphasis. Text wrapped with one or will be wrapped with an HTML tag; double *’s or ’s will be wrapped with an HTML tag. E.g., this input:

single asterisks

single underscores

double asterisks

double underscores

Tables

An example of table:

1
2
3
4
5
| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |

produce

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1