Class: Markbridge::AST::Color

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

Overview

Represents colored text. Note: Discourse doesn’t support inline color by default, but this preserves color information for migration/custom rendering.

Examples:

Colored text

color = AST::Color.new(color: "red")
color << AST::Text.new("Important text")

Instance Attribute Summary collapse

Attributes inherited from Element

#children

Instance Method Summary collapse

Methods inherited from Element

#<<

Constructor Details

#initialize(color: nil) ⇒ Color

Create a new Color element.

Parameters:

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

    color name or hex code



19
20
21
22
# File 'lib/markbridge/ast/color.rb', line 19

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

Instance Attribute Details

#colorString? (readonly)

Returns the color value (name or hex).

Returns:

  • (String, nil)

    the color value (name or hex)



14
15
16
# File 'lib/markbridge/ast/color.rb', line 14

def color
  @color
end