Sha256: 0a31c157fba4630392a3d253cea59b675dacbdf30d68d01f0bc4bf0465215811
Contents?: true
Size: 988 Bytes
Versions: 5
Compression:
Stored size: 988 Bytes
Contents
module Troy class Markdown # Create a new Redcarpet renderer, that prepares the code block # to use Prisme.js syntax. # module PrismJs def block_code(code, language) %[<pre class="language-#{language}"><code>#{CGI.escapeHTML(code)}</code></pre>] end end # Create a new Redcarpet renderer, that prepares the code block # to use Prisme.js syntax. # module Rouge include ::Rouge::Plugins::Redcarpet end class Renderer < Redcarpet::Render::HTML include Redcarpet::Render::SmartyPants include Rouge end # Set the Markdown markup that must be rendered. # attr_reader :markup def initialize(markup) @markup = markup end def renderer @renderer ||= Redcarpet::Markdown.new(Renderer, { :autolink => true, :space_after_headers => true, :fenced_code_blocks => true }) end def to_html renderer.render(markup) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
troy-0.0.27 | lib/troy/markdown.rb |
troy-0.0.26 | lib/troy/markdown.rb |
troy-0.0.25 | lib/troy/markdown.rb |
troy-0.0.24 | lib/troy/markdown.rb |
troy-0.0.23 | lib/troy/markdown.rb |