Class: Obsidian::MarkdownDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/obsidian/parser/markdown_document.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, root, markdown_parser:) ⇒ MarkdownDocument

Returns a new instance of MarkdownDocument.



5
6
7
8
9
# File 'lib/obsidian/parser/markdown_document.rb', line 5

def initialize(path, root, markdown_parser:)
  @path = path
  @root = root
  @markdown_parser = markdown_parser
end

Instance Method Details

#generate_htmlObject



11
12
13
14
# File 'lib/obsidian/parser/markdown_document.rb', line 11

def generate_html
  markdown = @path.read
  @markdown_parser.parse(markdown, root: @root).to_html
end