Module: Spotlight::RenderingHelper

Included in:
BrowseHelper, PagesHelper
Defined in:
app/helpers/spotlight/rendering_helper.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#render_markdown(text) ⇒ Object



5
6
7
8
9
10
# File 'app/helpers/spotlight/rendering_helper.rb', line 5

def render_markdown(text)
  # Extend Redcarpet renderer to add HTML anchors to each heading in the output HTML
  renderer = Redcarpet::Render::HTML.new(with_toc_data: true)
  # Use Redcarpet to render markdown as html
  Redcarpet::Markdown.new(renderer).render(text).html_safe
end