Class: Markbridge::AST::Align

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

Overview

Represents aligned text (left, center, right, justify). Note: Discourse has limited support for alignment.

Examples:

Center-aligned text

align = AST::Align.new(alignment: "center")
align << AST::Text.new("Centered text")

Instance Attribute Summary collapse

Attributes inherited from Element

#children

Instance Method Summary collapse

Methods inherited from Element

#<<

Constructor Details

#initialize(alignment: nil) ⇒ Align

Create a new Align element.

Parameters:

  • alignment (String, nil) (defaults to: nil)

    alignment value



18
19
20
21
# File 'lib/markbridge/ast/align.rb', line 18

def initialize(alignment: nil)
  super()
  @alignment = alignment
end

Instance Attribute Details

#alignmentString? (readonly)

Returns the alignment value (left, center, right, justify).

Returns:

  • (String, nil)

    the alignment value (left, center, right, justify)



13
14
15
# File 'lib/markbridge/ast/align.rb', line 13

def alignment
  @alignment
end