Module: Highlights::Formatter::Markdown

Included in:
Renderer
Defined in:
lib/highlights/formatter/markdown.rb

Instance Method Summary collapse

Instance Method Details

#render_markdownObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/highlights/formatter/markdown.rb', line 4

def render_markdown
  File.open(@outfile, 'w') do |file|
    file.puts("# #{@document.title}")
    file.write("\n")
    file.puts(@document.author)
    file.write("\n")
    file.puts("## Notes")
    file.write("\n")

    @document.notes.each do |note|
      file.puts("> #{note.annotation}")
      file.write("\n")
      file.puts("#{note.type}: #{note.location}")
      file.write("\n")
    end
  end
end