Class: Redcarpet::Render::HTMLwithTopic

Inherits:
HTMLwithSyntaxHighlight show all
Defined in:
lib/markdown.rb

Instance Method Summary collapse

Methods inherited from HTMLwithSyntaxHighlight

#autolink, #block_code, #image, #initialize, #table

Constructor Details

This class inherits a constructor from Redcarpet::Render::HTMLwithSyntaxHighlight

Instance Method Details

#header(text, header_level) ⇒ Object


80
81
82
83
84
# File 'lib/markdown.rb', line 80

def header(text, header_level)
  l = header_level <= 2 ? 2 : header_level
  raw_text = Nokogiri::HTML(text).xpath('//text()')
  %(<h#{l} id="#{raw_text}">#{text}</h#{l}>)
end