Class: Markbridge::AST::MarkdownText
- Defined in:
- lib/markbridge/ast/markdown_text.rb
Overview
Represents a text node containing pre-formatted Markdown content. Unlike AST::Text, this content will NOT be escaped by the renderer. Use this when you want to pass through Markdown formatting as-is.
Instance Attribute Summary collapse
-
#text ⇒ String
readonly
The markdown text content of this node.
Instance Method Summary collapse
-
#initialize(text) ⇒ MarkdownText
constructor
Create a new markdown text node with the given content.
-
#merge(other) ⇒ MarkdownText
Merge another markdown text node’s content into this one.
Constructor Details
#initialize(text) ⇒ MarkdownText
Create a new markdown text node with the given content.
22 23 24 |
# File 'lib/markbridge/ast/markdown_text.rb', line 22 def initialize(text) @text = +text end |
Instance Attribute Details
#text ⇒ String (readonly)
Returns the markdown text content of this node.
17 18 19 |
# File 'lib/markbridge/ast/markdown_text.rb', line 17 def text @text end |
Instance Method Details
#merge(other) ⇒ MarkdownText
Merge another markdown text node’s content into this one. This mutates the current text node by appending the other’s text.
31 32 33 34 |
# File 'lib/markbridge/ast/markdown_text.rb', line 31 def merge(other) @text << other.text self end |