我正在尝试找到一个可以在 rakefile 中使用的 markdown 解释器类/模块。
到目前为止,我已经找到了 maruku,但我对 beta 版本有点警惕。
有人遇到过 maruku 的问题吗? 或者,您知道更好的选择吗?
I'm trying to find a markdown interpreter class/module that I can use in a rakefile.
So far I've found maruku, but I'm a bit wary of beta releases.
Has anyone had any issues with maruku? Or, do you know of a better alternative?
发布评论
评论(9)
我每天使用 Maruku 处理 100,000 - 200,000 个文档。 主要是论坛帖子,但我也在维基页面等大型文档上使用它。 Maruku 比 BlueCloth 快得多,而且在处理大型文档时不会出现卡顿现象。 全部都是 Ruby,虽然代码不是特别容易扩展和扩充,但它是可行的。 我们对 Markdown 方言进行了一些调整和附加功能。
如果您想要纯 Ruby 的东西,我绝对推荐 Maruku。
对于最快的选项,您可能需要 RDiscount。 其核心是用 C 语言实现的。
另请参阅:“超越 BlueCloth”。
Ryan 的帖子包括以下 100 次 Markdown 迭代的基准测试:
2009 年 8 月更新
BlueCloth2 发布 ( http://www.deveiate.org/projects/BlueCloth)
它的速度与 RDiscount 相当,因为它基于 RDiscount - 它不是纯 Ruby。
(感谢 Jim)
2009 年 11 月更新
Kramdown 1.0 刚刚发布。 我还没有尝试过,但它是一个纯 Ruby Markdown 解析器,据称比 Maruku 快 5 倍。
2011 年 4 月更新
Maruku 自 2010 年 6 月以来就没有看到任何提交。您可能想查看 Kramdown。
一个新的非纯 Ruby 的快速选项:GitHub 发布了 Redcarpet,它基于 libupskirt:https://github.com/blog/832-rolling-out-the-redcarpet
2013 年 8 月更新
Kramdown 仍然是一个非常健康的项目(基于最近的提交、未解决的问题、拉取请求)和纯 Ruby Markdown 引擎的绝佳选择 https://github.com/gettalong/kramdown
Redcarpet 可能是对于不需要或不想要纯 Ruby 的人来说,它仍然是最常用和积极维护的选项。
I use Maruku to process 100,000 - 200,000 documents per day. Mostly forum posts but I also use it on large documents like wiki pages. Maruku is much faster than BlueCloth and it doesn't choke on large documents. It's all Ruby and although the code isn't especially easy to extend and augment, it is doable. We have a few tweaks and extras in our dialect of Markdown.
If you want something that is pure Ruby, I definitely recommend Maruku.
For the fastest option out there, you probably want RDiscount. The guts are implemented in C.
See also: "Moving Past BlueCloth" on Ryan Tomayko's blog.
Ryan's post includes the following benchmark of 100 iterations of a markdown test:
Update August 2009
BlueCloth2 was released (http://www.deveiate.org/projects/BlueCloth)
It's speed is on par with RDiscount because it is based on RDiscount - it is not pure Ruby.
(Thanks Jim)
Update November 2009
Kramdown 1.0 was just released. I haven't tried it yet, but it is a pure-Ruby Markdown parser that claims to be 5x faster than Maruku.
Update April 2011
Maruku hasn't seen a commit since June 2010. You may want to look into Kramdown instead.
A new fast option that is not pure Ruby: GitHub has released Redcarpet, which is based on libupskirt: https://github.com/blog/832-rolling-out-the-redcarpet
Update August 2013
Kramdown is still a very healthy project (based on recent commits, outstanding issues, pull requests) and a great choice for a pure Ruby Markdown engine https://github.com/gettalong/kramdown
Redcarpet is probably still the most commonly used and actively maintained option for people that don't need or want pure Ruby.
http://ruby-toolbox.com/categories/markup_processors.html 中的列表将是一个开始寻找的好地方。
The listing at http://ruby-toolbox.com/categories/markup_processors.html would be a good place to start looking.
RDiscount 快速且易于使用。
RDiscount is Fast and simple to use.
尝试 RDiscount。 BlueCloth 速度慢且有问题。
Try RDiscount. BlueCloth is slow and buggy.
casey 给出的答案中的基准使用 BlueCloth 1。BlueCloth 2 是目前最快的: http:// www.deveiate.org/projects/BlueCloth
The benchmark in the answer given by casey use BlueCloth 1. BlueCloth 2 is the fastest these days : http://www.deveiate.org/projects/BlueCloth
我相信 BlueCloth 是最突出的一个。
I believe BlueCloth is the most prominent one.
看起来很多答案都已经过时了。
截至目前(2013 年夏季)我发现的最好的东西是 Redcarpet gem:https://github.com /vmg/红地毯
Looks like a lot of these answers are outdated.
Best thing I've found out there as of now (summer 2013) is the Redcarpet gem: https://github.com/vmg/redcarpet
为了确保您获得 BlueCloth 2,请按如下方式安装:
请注意,“bluecloth”应全部小写,而不是驼峰式大小写。
来源:http://rubygems.org/gems/bluecloth
To ensure you're getting BlueCloth 2, install like this:
Note that "bluecloth" should be in all lowercase, not camel case.
Source: http://rubygems.org/gems/bluecloth
如果你需要一个关于如何在 rakefile 中使用类似 Kramdown 的例子,github 上有一个 repo,其中包含 markdown.md 中的代码和文章,可以使用 Ruby 代码语法突出显示转换为 html,但也有行号。(我更愿意关闭行编号)
如果有人知道如何关闭默认行编号,请告诉我们。
无论如何,链接是 https://github.com/elm-city-craftworks/practicing -ruby-手稿
If you need a fair example for how to use something like Kramdown in a rakefile there is a repo on github with code and articles in markdown.md that can be converted to html with Ruby code syntax highlighting but alas line numbers as well.(I would prefer to turn off line numbering)
If anyone knows how to shut off the line numbering default please tell us.
Anyway the link is https://github.com/elm-city-craftworks/practicing-ruby-manuscripts