Sha256: 066935f6389fba8fbbca138083a0cf7b3d8890688a1487d237cebb0cb3b122cc

Contents?: true

Size: 592 Bytes

Versions: 2

Compression:

Stored size: 592 Bytes

Contents

# encoding: utf-8

module Nanoc::Filters
  class Kramdown < Nanoc::Filter
    requires 'kramdown'

    # Runs the content through [Kramdown](http://kramdown.gettalong.org/).
    # Parameters passed to this filter will be passed on to Kramdown.
    #
    # @param [String] content The content to filter
    #
    # @return [String] The filtered content
    def run(content, params = {})
      document = ::Kramdown::Document.new(content, params)

      document.warnings.each do |warning|
        $stderr.puts "kramdown warning: #{warning}"
      end

      document.to_html
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 lib/nanoc/filters/kramdown.rb
nanoc-3.7.5 lib/nanoc/filters/kramdown.rb