&tag(Redcarpet);
*目次 [#xfb2296f]
#contents
*関連ページ [#k1d67c0b]
*参考情報 [#w0e430db]
-RubyのMarkdownライブラリ。

*使用方法 [#wfe3be11]
-Gemfileに追加
 gem "redcarpet", "~> 2.3.0"
-bundle実行
 bundle install --path=vendor/bundle
-ヘルパーの作成
-[[Railsでカスタムmarkdownを実装する - k0kubun's blog:http://k0kubun.hatenablog.com/entry/2013/09/19/223400]]より
#pre{{
module MarkdownHelper
  def markdown(text)
    unless @markdown
      renderer = Redcarpet::Render::HTML.new
      @markdown = Redcarpet::Markdown.new(renderer)
    end

    @markdown.render(text).html_safe
  end
end
}}
-ビューから呼び出す
 <%= markdown book.content %>


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS