Module: Middleman::Renderers::Markdown
- Defined in:
- middleman-more/lib/middleman-more/renderers/markdown.rb
Overview
Markdown renderer
Class Method Summary (collapse)
-
+ (Object) registered(app)
(also: included)
Once registered.
Class Method Details
+ (Object) registered(app) Also known as: included
Once registered
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'middleman-more/lib/middleman-more/renderers/markdown.rb', line 11 def registered(app) # Set our preference for a markdown engine # TODO: Find a JRuby-compatible version app.set :markdown_engine, :maruku app.set :markdown_engine_prefix, ::Tilt app.before_configuration do template_extensions :markdown => :html, :mdown => :html, :md => :html, :mkd => :html, :mkdn => :html end # Once configuration is parsed app.after_configuration do # Look for the user's preferred engine unless markdown_engine.nil? # Map symbols to classes markdown_engine_klass = if markdown_engine.is_a? Symbol engine = markdown_engine.to_s engine = engine == "rdiscount" ? "RDiscount" : engine.camelize markdown_engine_prefix.const_get("#{engine}Template") else markdown_engine_prefix end if markdown_engine == :redcarpet # Forcably disable Redcarpet1 support. # Tilt defaults to this if available, but the compat # layer disables extensions. require "redcarpet" Object.send(:remove_const, :RedcarpetCompat) if defined? ::RedcarpetCompat end # Tell tilt to use that engine ::Tilt.prefer(markdown_engine_klass) end end end |