Class: Protos::Markdown::Heading
- Inherits:
-
Data
- Object
- Data
- Protos::Markdown::Heading
- Defined in:
- lib/protos/markdown.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node
17 18 19 |
# File 'lib/protos/markdown.rb', line 17 def node @node end |
Instance Method Details
#header_level ⇒ Object
32 33 34 |
# File 'lib/protos/markdown.rb', line 32 def header_level node.header_level end |
#id ⇒ Object
18 19 20 |
# File 'lib/protos/markdown.rb', line 18 def id text.downcase.gsub(/[^a-z0-9]+/, "-").chomp("-") end |
#text ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/protos/markdown.rb', line 22 def text buffer = +"" node.walk do |node| buffer << node.string_content rescue TypeError # Ignore non-text nodes end buffer end |