module CommonMarker class HtmlRenderer < Renderer def render(node) super(node) end def header(node) block do out('', :children, '") end end def paragraph(node) if @in_tight && node.parent.type != :blockquote out(:children) else block do container('

', '

') do out(:children) end end end end def list(node) old_in_tight = @in_tight @in_tight = node.list_tight block do if node.list_type == :bullet_list container("') do out(:children) end else start = node.list_start == 1 ? "
    \n" : ('
      \n") container(start, '
    ') do out(:children) end end end @in_tight = old_in_tight end def list_item(node) block do container('
  1. ', '
  2. ') do out(:children) end end end def blockquote(node) block do container("
    \n", '
    ') do out(:children) end end end def hrule(node) block do out('
    ') end end def code_block(node) block do out('
     0
              out(' class="language-', node.fence_info.split(/\s+/)[0], '">')
            else
              out(">")
            end
            out(escape_html(node.string_content))
            out('
    ') end end def html(node) block do out(node.string_content) end end def inline_html(node) out(node.string_content) end def emph(node) out('', :children, '') end def strong(node) out('', :children, '') end def link(node) out(' 0 out(' title="', escape_html(node.title), '"') end out('>', :children, '') end def image(node) out('', :children, ' 0 out(' title="', escape_html(node.title), '"') end out(' />') end def text(node) out(escape_html(node.string_content)) end def code(node) out('') out(escape_html(node.string_content)) out('') end def linebreak(node) out('
    ') softbreak(node) end def softbreak(node) out("\n") end def escape_href(str) CommonMarker::Node.html_escape_href(str) end def escape_html(str) CommonMarker::Node.html_escape_html(str) end end end