class Kramdown::Document

used parser and the converter. See Document#new for more information!
The second argument to the #new method is an options hash for customizing the behaviour of the
The #to_html method is a shortcut for using the Converter::Html class.
puts doc.to_html
doc = Kramdown::Document.new(‘This is some kramdown text’)
require ‘kramdown’
formats. Use it like this:
This class provides a one-stop-shop for using kramdown to convert text into various output
The main interface to kramdown.

def initialize(source, options = {})

immediately available and the output can be generated.
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

def inspect #:nodoc:

:nodoc:
def inspect #:nodoc:
  "<KD:Document: options=#{@options.inspect} tree=#{@tree.inspect} warnings=#{@warnings.inspect}>"
end

def method_missing(id, *attr, &block)

For example, +to_html+ would instantiate the Kramdown::Converter::Html class.

class (i.e. a class in the Kramdown::Converter module) and use it for converting the document.
Check if a method is invoked that begins with +to_+ and if so, try to instantiate a converter
def method_missing(id, *attr, &block)
  if id.to_s =~ /^to_(\w+)$/
    Converter.const_get($1[0..0].upcase + $1[1..-1]).convert(self)
  else
    super
  end
end