search

Home  >  Q&A  >  body text

Python中的Markdown和Markdown2有何区别?

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.


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

迷茫迷茫2767 days ago631

reply all(5)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 12:08:01

    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

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 12:08:01

    It is said that Markdown2 is faster

    reply
    0
  • 迷茫

    迷茫2017-04-17 12:08:01

    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

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 12:08:01

    Another difference:

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

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 12:08:01

    Recommended misaka

    Python-markdown has a bug when parsing code blocks

    reply
    0
  • Cancelreply