Skip to content

Instantly share code, notes, and snippets.

@wzpan
Created June 14, 2013 05:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wzpan/5779645 to your computer and use it in GitHub Desktop.
Save wzpan/5779645 to your computer and use it in GitHub Desktop.
Using Pandoc instead of RedCarpet to render the page in Ruhoh. Supports markdown, rst and textile.
require "pandoc-ruby"
class Ruhoh
module Converter
module Markdown
def self.extensions
['.md', '.markdown']
end #self.extensions
def self.convert(content)
converter = PandocRuby.new(content).to_html(:smart,:mathjax,:email_obfuscation => :javascript)
converter
end #self.convert
end # Markdown
module Textile
def self.extensions
['.textile']
end #self.extensions
def self.convert(content)
converter = PandocRuby.new(content).to_html(:smart,:mathjax,:'email-obfuscation' => :javascript)
converter
end #self.convert
end # Textile
module RST
def self.extensions
['.rst']
end #self.extensions
def self.convert(content)
converter = PandocRuby.new(content).to_html(:smart,:mathjax,:'email-obfuscation' => :javascript)
converter
end #self.convert
end # RST
module Html
def self.extensions
['.htm', '.html']
end
def self.convert(content)
content
end
end # Html
end # Converter
end # Ruhoh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment