Class: MarkdownRecord::HtmlRenderer

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Defined in:
lib/markdown_record/rendering/html_renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_saver: ::MarkdownRecord::FileSaver.new) ⇒ HtmlRenderer

Returns a new instance of HtmlRenderer.



7
8
9
10
11
12
# File 'lib/markdown_record/rendering/html_renderer.rb', line 7

def initialize(
    file_saver: ::MarkdownRecord::FileSaver.new)
  super(::MarkdownRecord.config.html_render_options)
  @markdown = ::Redcarpet::Markdown.new(self, ::MarkdownRecord.config.markdown_extensions)
  @file_saver = file_saver
end

Instance Method Details

#render_html_for_subdirectory(subdirectory: "", **options) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/markdown_record/rendering/html_renderer.rb', line 14

def render_html_for_subdirectory(subdirectory: "", **options)
  
  start_path = ::MarkdownRecord.config.content_root.join(subdirectory)
  node = MarkdownRecord::Rendering::Nodes::HtmlDirectory.new(start_path, @markdown, options)

  node.render(@file_saver)
end