class Kramdown::Document
def initialize(source, options = {})
The +source+ is immediately parsed by the selected parser so that the document tree is
is not set, it defaults to +Kramdown+.
select the kramdown parser, one would set the :input key to +Kramdown+. If this key
+source+. It has to be the name of a class in the Kramdown::Parser module. For example, to
The special options key :input can be used to select the parser that should parse the
options that can be used are defined in the Options module.
Create a new Kramdown document from the string +source+ and use the provided +options+. The
def initialize(source, options = {}) @options = Options.merge(options) @warnings = [] @parse_infos = {} @parse_infos[:encoding] = source.encoding if RUBY_VERSION >= '1.9' @conversion_infos = {} parser = (options[:input] || 'kramdown').to_s parser = parser[0..0].upcase + parser[1..-1] if Parser.const_defined?(parser) @tree = Parser.const_get(parser).parse(source, self) else raise Kramdown::Error.new("kramdown has no parser to handle the specified input format: #{options[:input]}") end end