Class: Mdtoc::Node::FileNode

Inherits:
Node
  • Object
show all
Defined in:
lib/mdtoc/node.rb

Instance Method Summary collapse

Instance Method Details

#headersObject



77
78
79
80
81
82
83
84
# File 'lib/mdtoc/node.rb', line 77

def headers
  path_s = @path.to_s
  parser = Markdown::Parser.new(@depth, path_s)
  headers = parser.headers(@path.each_line)
  return headers if headers[0]&.top_level?(@depth)

  headers.unshift(Mdtoc::Markdown::Header.new(@depth, label, path_s))
end