Sha256: 025e3f47b992bb1ded6939dd516890039ba47756fa559d58f137c412b503c16c

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

module Maildown
  module MarkdownEngine
    def self.to_html(string)
      block.call(string)
    end

    def self.set(&block)
      Thread.current[:maildown_markdown_engine_block] = block
    end

    def self.block
      Thread.current[:maildown_markdown_engine_block] || default
    end

    def self.default
      require 'kramdown' unless defined? Kramdown

      ->(string) { Kramdown::Document.new(string).to_html }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
maildown-2.0.0 lib/maildown/markdown_engine.rb
maildown-1.0.4 lib/maildown/markdown_engine.rb
maildown-1.0.3 lib/maildown/markdown_engine.rb