Sha256: d69aab72d16add261956c9654a4205e511fb4789a3e51f26cdb97d95b5070a91

Contents?: true

Size: 596 Bytes

Versions: 4

Compression:

Stored size: 596 Bytes

Contents

require 'redcarpet'
require 'exceptionally_beautiful/html_renderer'

module ExceptionallyBeautiful
  class MarkdownRenderer
    attr_reader :text

    def initialize(text)
      @text = text
    end

    def render
      markdown.render(text).html_safe
    end

    private

    def markdown
      Redcarpet::Markdown.new(ExceptionallyBeautiful::HtmlRenderer, extensions)
    end

    def extensions
      {
        :autolink => true,
        :fenced_code_blocks => true,
        :no_intra_emphasis => true,
        :space_after_headers => true,
        :tables => true
      }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exceptionally_beautiful-0.1.5 lib/exceptionally_beautiful/markdown_renderer.rb
exceptionally_beautiful-0.1.4 lib/exceptionally_beautiful/markdown_renderer.rb
exceptionally_beautiful-0.1.3 lib/exceptionally_beautiful/markdown_renderer.rb
exceptionally_beautiful-0.1.2 lib/exceptionally_beautiful/markdown_renderer.rb