Module: Elabs::ContentRendererHelper

Defined in:
app/helpers/elabs/content_renderer_helper.rb

Instance Method Summary collapse

Instance Method Details

#markdown(text, reference_entity = nil, show_short_codes = true) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/elabs/content_renderer_helper.rb', line 3

def markdown(text, reference_entity = nil, show_short_codes = true)
  return '' if text.nil?

  process_short_codes CommonMarker.render_html(text, [:DEFAULT], [:table]).html_safe,
                      reference_entity,
                      show_short_codes
end

#render_entity_content(entity, field, show_short_codes = true) ⇒ Object



11
12
13
# File 'app/helpers/elabs/content_renderer_helper.rb', line 11

def render_entity_content(entity, field, show_short_codes = true)
  markdown entity.send(field), entity, show_short_codes
end