Module: Decidim::Api::ApplicationHelper

Defined in:
app/helpers/decidim/api/application_helper.rb

Overview

Custom helpers, scoped to the api engine.

Instance Method Summary collapse

Instance Method Details

#markdownObject



19
20
21
# File 'app/helpers/decidim/api/application_helper.rb', line 19

def markdown
  @markdown ||= Redcarpet::Render::HTML.new
end

#md_render(text) ⇒ Object



14
15
16
17
# File 'app/helpers/decidim/api/application_helper.rb', line 14

def md_render(text)
  text = Redcarpet::Markdown.new(markdown, autolink: true, tables: true, fenced_code_blocks: true).render(text)
  text.html_safe
end

#render_doc(file) ⇒ Object



10
11
12
# File 'app/helpers/decidim/api/application_helper.rb', line 10

def render_doc(file)
  md_render File.read(File.join(File.dirname(__FILE__), "../../../../docs", "#{file}.md"))
end