Class: Docks::Markdown::Renderer

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Defined in:
lib/docks/markdown.rb

Instance Method Summary collapse

Instance Method Details

#block_code(code, language) ⇒ Object



6
7
8
9
# File 'lib/docks/markdown.rb', line 6

def block_code(code, language)
  return nil unless language
  "<fenced_code_block #{"data-has-demo='true'" unless (language =~ /demo/).nil?} data-language='#{language.sub(/_?demo/, "")}'>#{code}</fenced_code_block>"
end


11
12
13
14
15
# File 'lib/docks/markdown.rb', line 11

def link(href, title, content)
  href = "@link #{content.gsub(/<[^>]*>/, "").strip}" if href.strip == "@link"
  content = "<span>#{content}</span>" unless content.strip.start_with?("<")
  "<a href=\"#{href}\"#{" title=\"#{title}\"" unless title.nil?}>#{content}</a>"
end