Class: Qiita::Markdown::Filters::Toc
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- Qiita::Markdown::Filters::Toc
- Defined in:
- lib/qiita/markdown/filters/toc.rb
Defined Under Namespace
Classes: Heading
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/qiita/markdown/filters/toc.rb', line 5 def call counter = Hash.new(0) doc.css("h1, h2, h3, h4, h5, h6").each do |node| heading = Heading.new(node, counter) heading.add_anchor_element if heading.has_first_child? heading.increment end doc end |