Module: PlanMyStuff::Markdown
- Defined in:
- lib/plan_my_stuff/markdown.rb
Class Method Summary collapse
-
.render(text, options = {}) ⇒ String
Renders markdown text to HTML using the configured renderer.
Class Method Details
.render(text, options = {}) ⇒ String
Renders markdown text to HTML using the configured renderer. Per-call options are deep-merged on top of config.markdown_options.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/plan_my_stuff/markdown.rb', line 19 def render(text, = {}) config = PlanMyStuff.configuration merged = config..deep_merge() case config.markdown_renderer when :commonmarker render_commonmarker(text, merged) when :redcarpet render_redcarpet(text, merged) when nil "<code>#{ERB::Util.html_escape(text)}</code>" else raise( ArgumentError, "Unknown markdown_renderer: #{config.markdown_renderer.inspect}. Use :commonmarker, :redcarpet, or nil.", ) end end |