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



68
69
70
71
72
73
74
# File 'lib/mdtoc/node.rb', line 68

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

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