Class: Mdtoc::Node::FileNode

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

Instance Method Summary collapse

Methods inherited from Mdtoc::Node

for_path, #initialize, #label, render

Constructor Details

This class inherits a constructor from Mdtoc::Node

Instance Method Details

#headersObject



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

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