Python中的Markdown和Markdown2有何区别?
迷茫
迷茫 2017-04-17 12:06:01
0
5
590

Markdown

Python implementation of Markdown.

This is a Python implementation of John Gruber's Markdown. It is almost completely compliant with the reference implementation, though there are a few known issues. See Features for information on what exactly is supported and what is not. Additional features are supported by the Available Extensions.


Markdown2

A fast and complete Python implementation of Markdown

markdown2: A fast and complete Python implementation of Markdown.

Markdown is a text-to-HTML filter; it translates an easy-to-read / easy-to-write structured text format into HTML. Markdown's text format is most similar to that of plain text email, and supports features such as headers, emphasis, code blocks, blockquotes, and links.


有对比么?大神们推荐使用哪个呢?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

全部回覆(5)
大家讲道理

Markdown2 更快一點?簡直是個笑話。你稍微做一下 benchmark 就不會這樣說了。

這裡是我在我的機器上跑的幾次數據:

Markdown: 47.7091s
Markdown2: 80.5163s

Markdown: 47.9369s
Markdown2: 79.5075s

Markdown: 46.4342s
Markdown2: 78.2267s

它們並沒有本質上的區別,除了 markdown2 自我吹噓了一把,騙了不少人。

我不知道提問者是在尋找一個 markdown 解析器,還是想要單純地做一個對比。如果是單純地做一個對比的話,答案就是 Markdown 更快一點,Markdown2 是單一文件。

但是如果提問者是想找一個更好的 markdown 解析器的話,那選擇還有很多。

  • Misaka: A python binding for Sundown. (CPython required)
  • Hoedown: A python binding for Hoedown, successor of Misaka.
  • Discount: A python binding for Discount. (CPython required)
  • cMarkdown: Markdown for Python, accelerated by C. (CPython required)
  • Markdown: A pure markdown parser, the very first implementation.
  • Markdown2: Another pure markdown parser.
  • Mistune: The fastest markdown parser in pure Python

具體的對比可參考這篇文章 Markdown Parsers in Python。

另外完整的 Benchmark 資料請見: https://github.com/lepture/mistune/issues/1

左手右手慢动作

據說是Markdown2更快一些

迷茫

官方文件說是Markdown2比Markdown 更迅速、更完整。用那個的話,你可以自己選擇,哪個舒服用哪個。就我個人來說,推薦Markdown2,就因為一個字:快

Peter_Zhu

另外說一個差別:

Python-Markdown的結構上比Markdown2好得多,擴充性也好,可以自訂extension。

Peter_Zhu

推薦misaka

python-markdown在解析程式碼區塊時有Bug

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!