Class: Obsidian::ParsedMarkdownDocument
- Inherits:
-
Object
- Object
- Obsidian::ParsedMarkdownDocument
- Defined in:
- lib/obsidian/parser/parsed_markdown_document.rb
Instance Method Summary collapse
- #extract_links ⇒ Object
-
#initialize(document, renderer:) ⇒ ParsedMarkdownDocument
constructor
A new instance of ParsedMarkdownDocument.
- #to_html ⇒ Object
Constructor Details
#initialize(document, renderer:) ⇒ ParsedMarkdownDocument
Returns a new instance of ParsedMarkdownDocument.
5 6 7 8 |
# File 'lib/obsidian/parser/parsed_markdown_document.rb', line 5 def initialize(document, renderer:) @document = document @renderer = renderer end |
Instance Method Details
#extract_links ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/obsidian/parser/parsed_markdown_document.rb', line 10 def extract_links results = [] document.walk do |node| if node.type == :link text = _extract_text_content(node) href = node.url results << [href, text] end end results end |
#to_html ⇒ Object
24 25 26 |
# File 'lib/obsidian/parser/parsed_markdown_document.rb', line 24 def to_html renderer.render(document) end |