module Webgen::ContentProcessor::Kramdown

Processes content in kramdown format (based on Markdown) using the kramdown library.

Public Class Methods

call(context) click to toggle source

Convert the content in context to HTML.

# File lib/webgen/content_processor/kramdown.rb, line 50
def self.call(context)
  options = context.website.config['content_processor.kramdown.options'].dup
  options[:link_defs] = context.website.ext.link_definitions.merge(options[:link_defs] || {})
  options[:input] = 'WebgenKramdown'
  doc = ::Kramdown::Document.new(context.content, options)
  context.content = CustomHtmlConverter.new(doc.root, doc.options, context).convert(doc.root)
  context.content.encode!(doc.root.options[:encoding])
  doc.warnings.each do |warn|
    context.website.logger.warn { "kramdown warning while parsing <#{context.ref_node}>: #{warn}" }
  end
  context
end