Markdownをpreg-markdownに切り替える
ついでに、
Formula
コメントのプレビューができるようにしました。

コメント中に $x=y$ のように記述することでインライン形式で数式を記述できます。
また、

\\[
f(x)=\int_0^x g(t)\,dt
\\]

のように書くことで、ディスプレイスタイルで数式を含めることも出来ます。

そのうちこちらのブログでもこの記法を使えるようにする予定です。

posted by genki genki on Mon 18 Aug 2008 at 23:56 with 0 comments
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