Class: MarkdownRails::Renderer::Base

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Defined in:
lib/markdown-rails/renderer/base.rb

Direct Known Subclasses

Rails

Instance Method Summary collapse

Instance Method Details

#enableObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/markdown-rails/renderer/base.rb', line 6

def enable
  # This is a very restrictive Markdown renderer that errs on the side of safety.
  # For more details read the docs at https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderer-for-lunch
  [
    :filter_html,
    :no_images,
    :no_links,
    :no_styles,
    :safe_links_only
  ]
end

#rendererObject



18
19
20
21
22
# File 'lib/markdown-rails/renderer/base.rb', line 18

def renderer
  # I can get away passing fatures into this class because they don't
  # overlap and RedCarpet is happy accepting both.
  ::Redcarpet::Markdown.new(self.class.new(**features), **features)
end