Class: Mdtoc::Markdown::HeaderWithFragment

Inherits:
Header
  • Object
show all
Defined in:
lib/mdtoc/markdown.rb

Instance Method Summary collapse

Methods inherited from Header

#to_s, #top_level?

Constructor Details

#initialize(depth, label, url) ⇒ HeaderWithFragment

Returns a new instance of HeaderWithFragment.



35
36
37
38
# File 'lib/mdtoc/markdown.rb', line 35

def initialize(depth, label, url)
  url = "#{url}##{label.downcase.strip.gsub(/ /, '-').gsub(/[^\w\-_ ]/, '')}"
  super
end