Sha256: 3a56f6f5b5a819daa5d767a3766c15710232a054035dc33a8be87ae5a017c089
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true 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::HTMLAbbreviations 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, footnotes: true) end def to_html renderer.render(markup) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
troy-0.0.39 | lib/troy/markdown.rb |
troy-0.0.38 | lib/troy/markdown.rb |
troy-0.0.37 | lib/troy/markdown.rb |
troy-0.0.36 | lib/troy/markdown.rb |