class Kramdown::Converter::Toc
def add_to_toc(el, id)
def add_to_toc(el, id) toc_element = Element.new(:toc, el, id: id) success = false until success if @stack.empty? @toc.children << toc_element @stack << toc_element success = true elsif @stack.last.value.options[:level] < el.options[:level] @stack.last.children << toc_element @stack << toc_element success = true else @stack.pop end end end