Class: ErbMarkdown

Inherits:
ApplicationMarkdown show all
Defined in:
lib/generators/markdown_rails/install/templates/app/markdown/erb_markdown.rb

Overview

DANGER! This parses Erb, which means arbitrary Ruby can be run. Make sure you trust the source of your markdown and that its not user input.

Instance Attribute Summary

Attributes inherited from MarkdownRails::Renderer::Rails

#view_context

Instance Method Summary collapse

Methods inherited from ApplicationMarkdown

#enable, #image

Methods inherited from MarkdownRails::Renderer::Rails

default_view_context, #image, #initialize, #renderer

Methods inherited from MarkdownRails::Renderer::Base

#enable, #renderer

Constructor Details

This class inherits a constructor from MarkdownRails::Renderer::Rails

Instance Method Details

#preprocess(html) ⇒ Object

Enables Erb to render for the entire doc before the markdown is rendered. This works great, except when you have an ‘erb` code fence.



7
8
9
10
# File 'lib/generators/markdown_rails/install/templates/app/markdown/erb_markdown.rb', line 7

def preprocess(html)
  # Read more about this render call at https://guides.rubyonrails.org/layouts_and_rendering.html
  render inline: html, handler: :erb
end