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
50 def self.call(context)
51   options = context.website.config['content_processor.kramdown.options'].dup
52   options[:link_defs] = context.website.ext.link_definitions.merge(options[:link_defs] || {})
53   options[:input] = 'WebgenKramdown'
54   doc = ::Kramdown::Document.new(context.content, options)
55   context.content = CustomHtmlConverter.new(doc.root, doc.options, context).convert(doc.root)
56   context.content.encode!(doc.root.options[:encoding])
57   doc.warnings.each do |warn|
58     context.website.logger.warn { "kramdown warning while parsing <#{context.ref_node}>: #{warn}" }
59   end
60   context
61 end