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

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.


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

迷茫
迷茫

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

reply all(5)
大家讲道理

Markdown2 faster? What a joke. If you do some benchmarking, you won’t say this.

Here is the data I ran several times on my machine:

Markdown: 47.7091s
Markdown2: 80.5163s

Markdown: 47.9369s
Markdown2: 79.5075s

Markdown: 46.4342s
Markdown2: 78.2267s

There is no essential difference between them, except that markdown2 boasted about itself and deceived many people.

I don’t know if the questioner is looking for a markdown parser, or if he just wants to do a comparison. If it is a simple comparison, the answer is that Markdown is faster, and Markdown2 is a single file.

But if the questioner is looking for a better markdown parser, there are many options.

  • 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

For specific comparison, please refer to this article Markdown Parsers in Python.

For complete Benchmark data, please check: https://github.com/lepture/mistune/issues/1

左手右手慢动作

It is said that Markdown2 is faster

迷茫

Official documentation says that Markdown2 is faster and more complete than Markdown. If you use that, you can choose whichever one is more comfortable for you to use. Personally, I recommend Markdown2, just because of one word: fast

Peter_Zhu

Another difference:

Python-Markdown is much better structurally than Markdown2, and its scalability is also good, and extensions can be customized.

Peter_Zhu

Recommended misaka

Python-markdown has a bug when parsing code blocks

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!