Pandoc實現了基本的Markdown語法外, 還加了一些extention.
細節可參考:
Pandoc's Markdown
Markdown語法
Markdown:Syntax
Pandoc Markdown and ReST Compared
Setext-style只有兩階也就是HTML語法裡的h1
及h2
tag,-
跟=
的個數沒有限制.
atx-style共有6階, h1
~h6
.
# This is H1.
## This is H2.
### This is H3.
#### ...
###### This is H6.
除了階層較多之外, atx-style還可以使用Markdown syntax.
###This is *H3* header.
Output:
斜體字: *
, _
, 粗體字: **
, __
,
*single asterisks*
_single underscores_
**double asterisks**
__double underscores__
Output:
single asterisks
single underscores
double asterisks
double underscores
~~~deleted text~~~
H~2~O is a liquid.
2^10^ is 1024.
Output:
deleted text
H2O is a liquid.
210 is 1024.
Pandoc可以使用LaTeX來表示數學式子, 可參考Getting Started with LaTeX
$a^2 = b^2 + c^2$
$x^{17} - 1$
$M^\bot = \{ f \in V' : f(m) = 0 \mbox{ for all } m \in M \}.$
$\[ \cos(\theta + \phi) = \cos \theta \cos \phi - \sin \theta \sin \phi \]$
$\[ |y - x| < \delta \]$ then $\[ |f(y) - f(x)| < \epsilon. \]$
\newcommand{\tuple}[1]{\langle #1 \rangle}
$\tuple{a, b, c}$
output:
a2 = b2 + c2x17 − 1M⊥ = {f ∈ Vʹ: f(m) = 0for all m ∈ M}. [cos(θ + φ) = cosθcosφ − sinθsinφ][∣y − x∣ < δ] then
[∣f(y) − f(x)∣ < ε. ]
⟨a, b, c⟩
This is an automatic link <http://www.google.com>.
This is [inline link](http://example.com/ "Title") inline link with title.
This is [inline link](http://example.com/ ) inline link without title attribute.
This is [reference link ][ref] with ID.
This is [reference link][] without ID.
This is [Inline Internal link](#TOC).
This is [Internal link].
[ref]: http://example.com/
[reference link]: http://www.google.com
[Internal link]: #pandocs-markdown-reference
Output:
This is an automatic link http://www.google.com
.
This is inline link inline link with title.
This is inline link inline link without title attribute.
This is reference link with ID.
This is reference link without ID.
This is Inline Internal link.
This is Internal link.
Markddown images sytax
![](http://3.bp.bloGspot.com/-BLhmfBdELH0/UBT3uUd7r5I/AAAAAAAAADw/-rnn2kz5vjY/s220/oops_monk01_120.jpg "OopsMonk")
![Alt text][pic2]
[pic2]: http://3.bp.bloGspot.com/-BLhmfBdELH0/UBT3uUd7r5I/AAAAAAAAADw/-rnn2kz5vjY/s220/oops_monk01_120.jpg
Output:
Markdown的貼圖不能指定圖片大小, 可以用HTML來放圖片.
<img src="http://3.bp.bloGspot.com/-BLhmfBdELH0/UBT3uUd7r5I/AAAAAAAAADw/-rnn2kz5vjY/s220/oops_monk01_120.jpg" width="50">
Output:
Markdown沒有嵌入影片的語法, 需要使用HTML.
<iframe src="http://embed.ted.com/talks/lang/zh-tw/ken_robinson_how_to_escape_education_s_death_valley.html"
width="560" height="315" frameborder="0" scrolling="no"
webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
Output:
This is one line code block `function()`
``There is a literal backtick (`) here.``
Bellow is a code block:
if(x == 0){
printf("x = 0");
else
printf("x =/= 0");
Output:
This is one line code block function()
There is a literal backtick (`) here.
Bellow is a code block:
if(x == 0){
printf("x = 0");
else
printf("x =/= 0");
~~~~~~~
if (a > 3) {
moveShip(5 * gravity, DOWN);
}
~~~~~~~
Output
if (a > 3) {
moveShip(5 * gravity, DOWN);
}
```python
import os
import sys
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return "Hello WSGI!!"
```
Output:
import os
import sys
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return "Hello WSGI!!"
~~~~ {#pycode .python .numberLines startFrom="10"}
import os
import sys
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return "Hello WSGI!!"
~~~~
Output:
10
11
12
13
14
15
| import os
import sys
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return "Hello WSGI!!"
|
> This is a block quote.
>
> > A block quote within a block quote.
> >
> > > Nets.
Output:
This is a block quote.
A block quote within a block quote.
Nets.
* fruits
+ apples
- macintosh
- red delicious
+ pears
+ peaches
* vegetables
+ brocolli
+ chard
Output:
1. list1.
1. list2.
1. list3.
1. list4.
Output:
- list1.
- list2.
- list3.
- list4.
5) Five
i. 5-1
i. 5-2
5) Six
iii. 6-1
* 6-1-1
* 6-1-2
iii. 6-2
iii. 6-3
5) Seven
a. 7-1
i. 7-2
#. 7-2-1
#. 7-2-2
i. 7-3
<!-- -->
5) Five again.
Output:
- Five
- 5-1
- 5-2
- Six
- 6-1
- 6-2
- 6-3
- Seven
- 7-1
- 7-2
- 7-2-1
- 7-2-2
- 7-3
- Five again.
語法中為:
與Definition
之間為 TAB
鍵.
Term 1
: Definition 1
Term 2 with *inline markup*
: Definition 2
{ some code, part of Definition 2 }
Third paragraph of definition 2.
Output:
- Term 1
Definition 1
- Term 2 with inline markup
Definition 2
{ some code, part of Definition 2 }
Third paragraph of definition 2.
另一種寫法, 裡面無法放入code block.
Term 1
~ Definition 1
Term 2
~ Definition 2a
~ Definition 2b
Output:
- Term 1
- Definition 1
- Term 2
- Definition 2a
- Definition 2b
(@) My first example will be numbered (1).
(@) My second example will be numbered (2).
Explanation of examples.
(@) My third example will be numbered (3).
(@good) This is a good example.
As (@good) illustrates, ...
Output:
- My first example will be numbered (1).
- My second example will be numbered (2).
Explanation of examples.
My third example will be numbered (3).
This is a good example.
As (4) illustrates, ...
註解會出現在文章的最後面.
Here is an inline note.^[Inlines notes are easier to write, since
you don't have to pick an identifier and move down to type the
note.]
Here is a footnote reference,^[^[^1]^]^ and another.[^longnote]
[^1]: Here is the footnote.
[^longnote]: Here's one with multiple blocks.
Subsequent paragraphs are indented to show that they
belong to the previous footnote.
{ some.code }
The whole paragraph can be indented, or just the first
line. In this way, multi-paragraph footnotes work like
multi-paragraph list items.
This paragraph won't be part of the note, because it
isn't indented.
Output:
Here is an inline note.
Here is a footnote reference,[] and another.
This paragraph won't be part of the note, because it isn't indented.
標準的Markdown沒有實現表格的標示.
Right Left Center Default
------- ------ ---------- -------
12 12 12 12
123 123 123 123
1 1 1 1
Output:
12 |
12 |
12 |
12 |
123 |
123 |
123 |
123 |
1 |
1 |
1 |
1 |
--------------------------
Centered Default Right Left
Header Aligned Aligned Aligned
----------- ------- --------------- -------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Here's another one. Note
the blank line between
rows.
--------------------------
Output:
First |
row |
12.0 |
Example of a row that spans multiple lines. |
Second |
row |
5.0 |
Here's another one. Note the blank line between rows. |
----------- ------- --------------- -------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Here's another one. Note
the blank line between
rows.
----------- ------- --------------- -------------------------
Output:
First |
row |
12.0 |
Example of a row that spans multiple lines. |
Second |
row |
5.0 |
Here's another one. Note the blank line between rows. |
This is end of article, show defined footnotes as below: