Class: Rabbit::Parser::Markdown

Inherits:
Base
  • Object
show all
Defined in:
lib/rabbit/parser/markdown.rb,
lib/rabbit/parser/markdown.rb,
lib/rabbit/parser/markdown/converter.rb

Defined Under Namespace

Classes: Converter

Constant Summary

Constants included from ModuleLoader

ModuleLoader::LOADERS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from ModuleLoader

extend_object, #find_loader, #loaders, #push_loader, #unshift_loader

Constructor Details

This class inherits a constructor from Rabbit::Parser::Base

Class Method Details

.format_nameObject


112
113
114
# File 'lib/rabbit/parser/markdown.rb', line 112

def format_name
  "Makrdown"
end

.match?(source) ⇒ Boolean

Returns:

  • (Boolean)

116
117
118
# File 'lib/rabbit/parser/markdown.rb', line 116

def match?(source)
  /\A(?:md|markdown)\z/i =~ source.extension.to_s
end

Instance Method Details

#parseObject


121
122
123
124
125
# File 'lib/rabbit/parser/markdown.rb', line 121

def parse
  document = Kramdown::Document.new(@source.read)
  converter = Converter.new(@canvas)
  converter.convert(document.root)
end