class Bridgetown::Converters::Markdown::KramdownParser

Attributes

extractions[R]

Public Class Methods

new(config) click to toggle source
# File lib/bridgetown-core/converters/markdown/kramdown_parser.rb, line 74
def initialize(config)
  @config = config["kramdown"] || {}
  @config["syntax_highlighter"] ||= config["highlighter"] || "rouge"
  @config["syntax_highlighter_opts"] ||= {}
  @config["syntax_highlighter_opts"]["guess_lang"] = @config["guess_lang"]
  require "kramdown-parser-gfm" if @config["input"] == "GFM"
end

Public Instance Methods

convert(content) click to toggle source
# File lib/bridgetown-core/converters/markdown/kramdown_parser.rb, line 82
def convert(content)
  document = Kramdown::BridgetownDocument.new(content, @config)
  html_output = document.to_html
  if @config["show_warnings"]
    document.warnings.each do |warning|
      Bridgetown.logger.warn "Kramdown warning:", warning
    end
  end
  @extractions = document.root.options[:extractions] # could be nil
  html_output
end