02 April 2015

markdown: Syntax


  • Overview

    • Philosophy
    • Inline HTML
    • Automatic Escaping for Special Characters
  • Block Elements

    • Paragraphs and Line Breaks
    • Headers
    • Blockquotes
    • Lists
    • Code Blocks
    • Horizontal Rules
  • Span Elements
    • Links
    • Emphasis
    • Code
    • Images
  • Miscellaneous
    • Backslash Escapes
    • Automatic Links

Block Elements


Paragraphs and Line Breaks

A blank line is any line that looks like a blank line -- a line containing nothing but spaces or tabs is considered blank.

---

Header

# This is an H1
## This is an H2
### This is an H3
#### This is an H4
##### This is an H5
###### This is an H6

This is an H1

This is an H2

This is an H3

This is an H4

This is an H5
This is an H6

Blockquotes

> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.

This is the first level of quoting.

This is nested blockquote.

Back to the first level.

> ## This is a header.
> 
> 1.   This is the first list item.
> 2.   This is the second list item.
> 
> Here's some example code:
> 
>     return shell_exec("echo $input | $markdown_script");

This is a header.

  1. This is the first list item.
  2. This is the second list item.

Here's some example code:

return shell_exec("echo $input | $markdown_script");

Lists

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

Unordered use * + -

* red
* green
* blue
  • red
  • green
  • blue

Ordered lists use numbers followed by periods:

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

Code Blocks

This is a normal paragraph:

    This is a code block.

This is a normal paragraph:

This is a code block.

Horizontal Rules

* * *

***

*****

- - -

---------------------------------------





Span Elements


Links

inline

This is [an example](http://example.com/ "Title") inline link.

[This link](http://example.net/) has no title attribute.

This is an example inline link.

This link has no title attribute.

reference

I get 10 times more traffic from [Google] [1] than from
[Yahoo] [2] or [MSN] [3].

  [1]: http://google.com/        "Google"
  [2]: http://search.yahoo.com/  "Yahoo Search"
  [3]: http://search.msn.com/    "MSN Search

I get 10 times more traffic from Google than from Yahoo or MSN.

Emphasis

*single asterisks*

_single underscores_

**double asterisks**

__double underscores__

single asterisks

single underscores

double asterisks

double underscores

Code

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

Use the `printf()` function.

Use the printf() function.

Images

![Alt text](/path/to/img.jpg)

![Alt text](/assets/img/jiaxianhua.png "Optional title")

Alt text

Alt text

Miscellaneous


Automatic Links

<http://jiaxianhua.com/>

http://jiaxianhua.com/

<address@example.com>

address@example.com

Backslash Escapes

\*literal asterisks\*

*literal asterisks*

\   backslash
`   backtick
*   asterisk
_   underscore
{}  curly braces
[]  square brackets
()  parentheses
#   hash mark
+   plus sign
-   minus sign (hyphen)
.   dot
!   exclamation mark


blog comments powered by Disqus