Class: Jekyll::Converters::SmartyPants

Inherits:
Jekyll::Converter show all
Defined in:
lib/jekyll/converters/smartypants.rb

Constant Summary

Constants inherited from Plugin

Plugin::PRIORITIES

Instance Method Summary collapse

Methods inherited from Jekyll::Converter

highlighter_prefix, #highlighter_prefix, highlighter_suffix, #highlighter_suffix

Methods inherited from Plugin

#<=>, <=>, catch_inheritance, descendants, inherited, priority, safe

Constructor Details

#initialize(config) ⇒ SmartyPants

Returns a new instance of SmartyPants.



22
23
24
25
26
27
28
# File 'lib/jekyll/converters/smartypants.rb', line 22

def initialize(config)
  unless defined?(Kramdown)
    Jekyll::External.require_with_graceful_fail "kramdown"
  end
  @config = config["kramdown"].dup || {}
  @config[:input] = :SmartyPants
end

Instance Method Details

#convert(content) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/jekyll/converters/smartypants.rb', line 38

def convert(content)
  document = Kramdown::Document.new(content, @config)
  html_output = document.to_html.chomp
  if @config["show_warnings"]
    document.warnings.each do |warning|
      Jekyll.logger.warn "Kramdown warning:", warning.sub(%r!^Warning:\s+!, "")
    end
  end
  html_output
end

#matches(_) ⇒ Object



30
31
32
# File 'lib/jekyll/converters/smartypants.rb', line 30

def matches(_)
  false
end

#output_ext(_) ⇒ Object



34
35
36
# File 'lib/jekyll/converters/smartypants.rb', line 34

def output_ext(_)
  nil
end