Class: Jekyll::Converters::Markdown::KramdownRespecParser

Inherits:
KramdownParser
  • Object
show all
Defined in:
lib/converters/markdown/kramdownrespec-parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ KramdownRespecParser

Returns a new instance of KramdownRespecParser.



8
9
10
11
12
13
14
15
16
17
# File 'lib/converters/markdown/kramdownrespec-parser.rb', line 8

def initialize(config)
  # super
  unless defined?(KramdownRespec)
    Jekyll::External.require_with_graceful_fail "kramdown-respec"
  end
  @main_fallback_highlighter = config["highlighter"] || "rouge"
  @config = config["kramdown-respec"] || {}
  @highlighter = nil
  # setup
end

Instance Method Details

#convert(content) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/converters/markdown/kramdownrespec-parser.rb', line 19

def convert(content)
  document = Kramdown::Document.new(content, @config)
  html_output = document.to_html
  if @config["show_warnings"]
    document.warnings.each do |warning|
      Jekyll.logger.warn "Kramdown warning:", warning
    end
  end
  html_output
end