Class: MDV::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/mdv/document.rb

Overview

Markdown document class

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Document

Returns a new instance of Document.



8
9
10
# File 'lib/mdv/document.rb', line 8

def initialize(file)
  @file = file
end

Instance Method Details

#base_uriObject



12
13
14
# File 'lib/mdv/document.rb', line 12

def base_uri
  @base_uri ||= "file://#{fullpath}"
end

#htmlObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/mdv/document.rb', line 16

def html
  content = File.read(fullpath)
  Commonmarker.to_html(content,
    options: {render: {hardbreaks: false},
              extension: {tagfilter: true,
                          autolink: true,
                          table: true,
                          strikethrough: true,
                          header_ids: nil}},
    plugins: {})
end