Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

Markdown Implementations for C/C++


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. peg-markdown depends on GLib and other 3rd part tools. I've tested it, it works quite well.

    Advantages:

    • Dual-licensed under GPL and MIT.
    • Uses internally formal grammar, so easy to maintain and extend.

    Disadvantages:

    • Depends on GLib
    • Provides C API.
  2. Cpp-Markdown, Most C++ code but it is quite slow and little bit bloated. On the other hand it is quite easy to understand and modify, Depends on boost-1.35.

    Advantages

    • Depends only on boost
    • Written in C++, looks like less dangerous
    • Licensed under MIT.

    Disadvantages

    • Slow (it is still about 10 times faster then Perl implementation, but about 10 times slower than Discount)
  3. Discount, This is the code I use for my blog http://art-blog.no-ip.info/cppcms/blog and wiki http://art-blog.no-ip.info/wikipp/en/page/main. It is written by hardcore C programmer and quite hardly mantainable (even the developer activly maintains it).

    Advantages

    • Extremely fast
    • Written in pure C (no 3rd part dependencies).
    • Actively maintained
    • Has permissive 3 clause BSD license

    Disadvantages

    • Almost impossible to maintain (even I could remove/add some fatures).
    • Has only FILE API, so I should tweak the code to make it work with general buffer.
    • Licensed under 4 clause BSD license that is incompatible with GPL. It is problematic if you want to use it not as part of your GPL-ed software.

Why do I know them so much?

I'm developing CppCMS, so I need a good markdown to HTML convertor. When I picked one (Discount), it was the only solution. Since then I've needed to replace it due to licensing issues. That said, I still quite like it because it is the fastest Markdown solution.

P.S.: If you want C++ wrapper for Discount, take a look on http://cppcms.svn.sourceforge.net/viewvc/cppcms/cms/trunk/cxxmarkdown/, It is not the latest version, but it is already tweaked.

EDIT: I have just visited Discount site and I had found that it had added a non-FILE API as well. So now it is real library.

EDIT 2: If you find better implementation or write your own under FOSS license, let me know ;)

EDIT 3: as cloose commented, discount had changed the license to 3 clause BSD.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...