Class: Jekyll::Converters::Markdown::KramdownParser
- Inherits:
-
Object
- Object
- Jekyll::Converters::Markdown::KramdownParser
- Defined in:
- lib/jekyll/converters/markdown/kramdown_parser.rb
Instance Method Summary collapse
- #convert(content) ⇒ Object
-
#initialize(config) ⇒ KramdownParser
constructor
A new instance of KramdownParser.
Constructor Details
#initialize(config) ⇒ KramdownParser
Returns a new instance of KramdownParser.
5 6 7 8 9 10 11 12 |
# File 'lib/jekyll/converters/markdown/kramdown_parser.rb', line 5 def initialize(config) require 'kramdown' @config = config rescue LoadError STDERR.puts 'You are missing a library required for Markdown. Please run:' STDERR.puts ' $ [sudo] gem install kramdown' raise FatalException.new("Missing dependency: kramdown") end |
Instance Method Details
#convert(content) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll/converters/markdown/kramdown_parser.rb', line 14 def convert(content) # Check for use of coderay if @config['kramdown']['use_coderay'] @config['kramdown'].merge!({ :coderay_wrap => @config['kramdown']['coderay']['coderay_wrap'], :coderay_line_numbers => @config['kramdown']['coderay']['coderay_line_numbers'], :coderay_line_number_start => @config['kramdown']['coderay']['coderay_line_number_start'], :coderay_tab_width => @config['kramdown']['coderay']['coderay_tab_width'], :coderay_bold_every => @config['kramdown']['coderay']['coderay_bold_every'], :coderay_css => @config['kramdown']['coderay']['coderay_css'] }) end Kramdown::Document.new(content, @config["kramdown"].symbolize_keys).to_html end |