Class: Perron::Markdown::RedcarpetParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/perron/markdown.rb

Instance Attribute Summary

Attributes inherited from Parser

#options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Parser

#initialize

Constructor Details

This class inherits a constructor from Perron::Markdown::Parser

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


70
# File 'lib/perron/markdown.rb', line 70

def self.available? = defined?(::Redcarpet)

Instance Method Details

#markdownObject



64
65
66
# File 'lib/perron/markdown.rb', line 64

def markdown
  @markdown ||= Redcarpet::Markdown.new(renderer, options.fetch(:markdown_options, {}))
end

#parse(text) ⇒ Object



68
# File 'lib/perron/markdown.rb', line 68

def parse(text) = markdown.render(text)

#rendererObject



60
61
62
# File 'lib/perron/markdown.rb', line 60

def renderer
  @renderer ||= Redcarpet::Render::HTML.new(options.fetch(:renderer_options, {}))
end