Module: Elabs::ContentRendererHelper
- Defined in:
- app/helpers/elabs/content_renderer_helper.rb
Constant Summary collapse
- ALPHABET =
('a'..'z').to_a
Instance Method Summary collapse
Instance Method Details
#markdown(text) ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/helpers/elabs/content_renderer_helper.rb', line 5 def markdown(text) area_id = Array.new(5) { ALPHABET.sample }.join content = ''.html_safe content += content_tag('pre', text, id: "raw-#{area_id}") content += javascript_tag("renderMdFromId('#{area_id}')").html_safe content_tag('div', content, id: "markdown-#{area_id}").html_safe end |