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
Class Method Details
.from_ast(elements) ⇒ Object
Create a document from an array of blocks
43 44 45 |
# File 'lib/coradoc/markdown/model/document.rb', line 43 def self.from_ast(elements) new(blocks: elements) end |
Instance Method Details
#[](index) ⇒ Coradoc::Markdown::Base
Returns The block at the specified index.
32 33 34 |
# File 'lib/coradoc/markdown/model/document.rb', line 32 def [](index) blocks[index] end |
#[]=(index, value) ⇒ Object
38 39 40 |
# File 'lib/coradoc/markdown/model/document.rb', line 38 def []=(index, value) blocks[index] = value end |