RubyでMarkdown記法というと、BlueClothが有名なのではないかと思いますが、rdiscountとrpeg_markd
Better Markdown Libraries for Ruby: RDiscount and rpeg-markd
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 MacFarlean e’s peg-markdo wn.
早速 Formula で使ってみようと検証していたのですが、上述の二つのライブラリには、 エスケープの仕方でMARKDOWN記法の解釈に以下のような違いがあるようです。
1 source = "[test](http://foo.com/?x%3Dx%2B5% 2B2y)" 2 RDiscount.new(source).to_html 3 #=> "<p><a href=\"http://foo .com/?x%253Dx%25 2B5%252B2y \">test</a></p>\n" 4 Markdown.new(source).to_html # rpeg-markd own 5 #=> "\n\n<p><a href=\"http://foo .com/?x%3Dx%2B5% 2B2y\">test</a></p>"
RDiscountの方は、エスケープ済みのQuery Stringをもう一回エスケープしてしまっているようです。
posted by
genki
on Mon 18 Aug 2008
at 23:35
with
2 comments
追記
rpeg_markdownをインストールするにあたって、
のパッケージをインストールする必要がありました。
See Also