转自:P_Chou Tech Space http://www.pchou.info/open-source/2014/07/07/something-about-markdown.html
作者: P_Chou
Markdown在标准语法(http://daringfireball.net/projects/markdown/syntax )之外,还支持各种扩展。
Markdown的php解析与实现,并且增加了许多有用的扩展。PHP Markdown Extra其中几个比较重要的改进有:
[Link back to header 1](#header1) Header 1 {#header1} ======== ## Header 2 ## {#header2}
支持元素包括header、code block、link、image
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.html #example-1} <p>paragraph <b>emphasis</b> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Function name | Description | | ------------- | ------------------------------ | | `help()` | Display the help window. | | `destroy()` | **Destroy your computer!** |
That's some text with a footnote.[^1] [^1]: And that's the footnote.
在”始作俑者PHP Markdown Extra”后,很多基于Ruby的Markdown解释器开始浮现。其中,Maruku号称:
Maruku的语法详见这里
不过,该项目已经停止维护了。
同样是ruby开发的解释器,kramdown吸取了Maruku几乎所有的特点,功能更为强大。其中有特点的功能有:
RDiscount又是一个基于Ruby开发的解释器,不过它是基于Discount的语法移植的,所以语法规则需要参考Discount。其语法支持几种上面没有提到过的特性:
Redcarpet是一个转化库,可以在标准Markdown的基础上,配置一些额外的功能:
Github Page对于上述的基于Ruby的markdown是支持的,从这里可以看到。另外,Github对于Issue、comments等,还定义了GFM(GitHub Flavored Markdown),其中的语法一般基本来源于上面的提到的东西。除此之外,github还支持一些额外的特性:
- [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> are supported - [x] list syntax is required (any unordered or ordered list supported) - [x] this is a complete item - [ ] this is an incomplete item