Skip to content

Instantly share code, notes, and snippets.

@mba811
Created April 16, 2015 08:25
Show Gist options
  • Select an option

  • Save mba811/d0f508a90abcabc25757 to your computer and use it in GitHub Desktop.

Select an option

Save mba811/d0f508a90abcabc25757 to your computer and use it in GitHub Desktop.
Only support redcarpet with rouge as syntax highlighter.(kitabu)
module Kitabu
module Markdown
class Renderer < Redcarpet::Render::HTML
include Redcarpet::Render::SmartyPants
include Rouge::Plugins::Redcarpet
end
class << self
# Set markdown renderer
attr_accessor :processor
end
renderer = Renderer.new(hard_wrap: true, safe_links_only: true)
self.processor = Redcarpet::Markdown.new(renderer, {
tables: true,
footnotes: true,
space_after_headers: true,
superscript: true,
highlight: true,
strikethrough: true,
autolink: true,
fenced_code_blocks: true,
no_intra_emphasis: true
})
def self.render(text)
processor.render(text)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment