Class: ViewSpec::MarkdownRenderer

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Defined in:
lib/view_spec/markdown_renderer.rb

Constant Summary collapse

HTML_ELEMENT_MATCHER =
/^(<([a-z\-]+)(?:\s[^>]*)?>((?:(?!<\/([a-z\-]+)>).)*)<\/([a-z\-]+)>)$/m

Instance Method Summary collapse

Instance Method Details

#paragraph(content) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/view_spec/markdown_renderer.rb', line 5

def paragraph(content)
  if HTML_ELEMENT_MATCHER.match?(content.strip)
    content.html_safe
  else
    "<p>#{content}</p>".html_safe
  end
end