Sha256: 81d22f7bba9023f768660e49e58f26aec80695abbffdf3f1663f4c306e6d24a6

Contents?: true

Size: 701 Bytes

Versions: 6

Compression:

Stored size: 701 Bytes

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kitabu-2.1.0 lib/kitabu/markdown.rb
kitabu-2.0.4 lib/kitabu/markdown.rb
kitabu-2.0.3 lib/kitabu/markdown.rb
kitabu-2.0.2 lib/kitabu/markdown.rb
kitabu-2.0.1 lib/kitabu/markdown.rb
kitabu-2.0.0 lib/kitabu/markdown.rb