0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Rails] マークダウン形式でtext_areaに入力できるようにする

Posted at

commonmarker

  • gem commonmakerをインストール
gem 'commonmarker'
  • helperに下記を記述
 def markdown_to_html(text)
   html = Commonmarker.to_html(text)
   raw(html)
 end
end
  • 例)show.html.haml
= markdown_to_html("# CommonMarker")

image.png

参考URL

思いのほかサクッと実装できました。
何かご指摘あればお願いします!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?