class Decidim::Comments::MarkdownRender

Custom markdown renderer for Comments

Public Class Methods

new(extensions = {}) click to toggle source
Calls superclass method
# File lib/decidim/comments/markdown.rb, line 25
def initialize(extensions = {})
  super({
    autolink: true,
    escape_html: false,
    filter_html: true,
    hard_wrap: true,
    lax_spacing: false,
    no_images: true,
    no_styles: true
  }.merge(extensions))
end

Public Instance Methods

block_quote(quote) click to toggle source

renders quotes with a custom css class

# File lib/decidim/comments/markdown.rb, line 38
def block_quote(quote)
  %(<blockquote class="comment__quote">#{quote}</blockquote>)
end
header(title, _level) click to toggle source

removes header tags in comments

# File lib/decidim/comments/markdown.rb, line 43
def header(title, _level)
  title
end
paragraph(text) click to toggle source

prevents empty <p/> in comments

# File lib/decidim/comments/markdown.rb, line 48
def paragraph(text)
  return if text.blank?

  "<p>#{text}</p>"
end