Class: Coradoc::Markdown::Document
- Defined in:
- lib/coradoc/markdown/model/document.rb
Overview
Document model representing a Markdown document.
The Document class is the main container for parsed Markdown content. It holds the document’s blocks (headings, paragraphs, lists, etc.).
Class Method Summary collapse
-
.from_ast(elements) ⇒ Object
Create a document from an array of blocks.
Instance Method Summary collapse
-
#[](index) ⇒ Coradoc::Markdown::Base
The block at the specified index.
- #[]=(index, value) ⇒ Object
Methods inherited from Base
#serialize_content, #to_h, #to_md, visit, #visit
Class Method Details
.from_ast(elements) ⇒ Object
Create a document from an array of blocks
34 35 36 |
# File 'lib/coradoc/markdown/model/document.rb', line 34 def self.from_ast(elements) new(blocks: elements) end |
Instance Method Details
#[](index) ⇒ Coradoc::Markdown::Base
Returns The block at the specified index.
23 24 25 |
# File 'lib/coradoc/markdown/model/document.rb', line 23 def [](index) blocks[index] end |
#[]=(index, value) ⇒ Object
29 30 31 |
# File 'lib/coradoc/markdown/model/document.rb', line 29 def []=(index, value) blocks[index] = value end |