Class: Markbridge::AST::Heading

Inherits:
Element show all
Defined in:
lib/markbridge/ast/heading.rb

Overview

Represents a heading element with a level (1-6).

Examples:

heading = AST::Heading.new(level: 2)
heading << AST::Text.new("Section Title")

Instance Attribute Summary collapse

Attributes inherited from Element

#children

Instance Method Summary collapse

Methods inherited from Element

#<<

Constructor Details

#initialize(level:) ⇒ Heading

Create a new heading element.

Parameters:

  • level (Integer)

    the heading level (1-6)



17
18
19
20
# File 'lib/markbridge/ast/heading.rb', line 17

def initialize(level:)
  super()
  @level = level
end

Instance Attribute Details

#levelInteger (readonly)

Returns the heading level (1-6).

Returns:

  • (Integer)

    the heading level (1-6)



12
13
14
# File 'lib/markbridge/ast/heading.rb', line 12

def level
  @level
end