`
myrev
  • 浏览: 163210 次
  • 性别: Icon_minigender_1
  • 来自: 福建
社区版块
存档分类
最新评论

Rails plugin Markdown

阅读更多
1. RDiscount

http://github.com/rtomayko/rdiscount

> sudo gem install rdiscount


Usage

RDiscount implements the basic protocol popularized by RedCloth and adopted by BlueCloth:

require 'rdiscount'
markdown = RDiscount.new("Hello World!")
puts markdown.to_html


Additional processing options can be turned on when creating the RDiscount object:

markdown = RDiscount.new("Hello World!", :smart, :filter_html)


Inject RDiscount into your BlueCloth-using code by replacing your bluecloth require statements with the following:

begin
  require 'rdiscount'
  BlueCloth = RDiscount
rescue LoadError
  require 'bluecloth'
end



2. BlueCloth

http://deveiate.org/projects/BlueCloth

> sudo gem install bluecloth


Usage
require "bluecloth"

markdown = BlueCloth.new("<p>Hi</p>") or Markdown.new("<p>Hi</p>")

markdown.to_html



Tip : # BlueCloth has set the top-level 'Markdown' constant
::Markdown = ::BlueCloth unless defined?( ::Markdown )

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics