# File lib/asciidoctor/converter/html5.rb, line 299
    def outline node, opts = {}
      return unless node.sections?
      sectnumlevels = opts[:sectnumlevels] || (node.document.attr 'sectnumlevels', 3).to_i
      toclevels = opts[:toclevels] || (node.document.attr 'toclevels', 2).to_i
      sections = node.sections
      # FIXME top level is incorrect if a multipart book starts with a special section defined at level 0
      result = [%(<ul class="sectlevel#{sections[0].level}">)]
      sections.each do |section|
        slevel = section.level
        if section.caption
          stitle = section.captioned_title
        elsif section.numbered && slevel <= sectnumlevels
          stitle = %(#{section.sectnum} #{section.title})
        else
          stitle = section.title
        end
        if slevel < toclevels && (child_toc_level = outline section, :toclevels => toclevels, :secnumlevels => sectnumlevels)
          result << %(<li><a href="##{section.id}">#{stitle}</a>)
          result << child_toc_level
          result << '</li>'
        else
          result << %(<li><a href="##{section.id}">#{stitle}</a></li>)
        end
      end
      result << '</ul>'
      result * LF
    end