RubyでMarkdown記法というと、BlueClothが有名なのではないかと思いますが、rdiscountとrpeg_markdownという新しいライブラリが Daring Fireball氏のこちらの記事で紹介されていました。 [**Better Markdown Libraries for Ruby: RDiscount and rpeg-markdown**](http://mac.blogdig.net/archives/articles/August2008/17/Better_Markdown_Libraries_for_Ruby__RDiscount_and_rpeg_markdown.html) >Ryan Tomayko has solved this with two new Ruby extensions that wrap extremely fast (and accurate) C libraries for Markdown: David Loren Parsons’s Discount and Jon MacFarleane’s peg-markdown. 早速 [Formula](http://formula.s21g.com/) で使ってみようと検証していたのですが、上述の二つのライブラリには、 エスケープの仕方でMARKDOWN記法の解釈に以下のような違いがあるようです。 ruby>> source = "[test](http://foo.com/?x%3Dx%2B5%2B2y)" RDiscount.new(source).to_html #=> "

test

\n" Markdown.new(source).to_html # rpeg-markdown #=> "\n\n

test

" <<-- RDiscountの方は、エスケープ済みのQuery Stringをもう一回エスケープしてしまっているようです。
posted by genki genki on Mon 18 Aug 2008 at 23:23 with 2 comments
瀧内元気 瀧内元気 08/18 23:50
**追記**

rpeg_markdownをインストールするにあたって、

* pkg-config
* libglib2.0-dev

のパッケージをインストールする必要がありました。
瀧内元気 瀧内元気 08/19 00:37
**See Also**

* [**Moving Past BlueCloth**](http://tomayko.com/writings/ruby-markdown-libraries-real-cheap-for-you-two-for-price-of-one)