class Kramdown::Parser::Base

def adapt_source(source)

+\n+ and makes sure +source+ ends with a new line character).
Modify the string +source+ to be usable by the parser (unifies line ending characters to
def adapt_source(source)
  if source.respond_to?(:encode)
    if !source.valid_encoding?
      raise "The source text contains invalid characters for the used encoding #{source.encoding}"
    end
    source = source.encode('UTF-8')
  end
  source.gsub(/\r\n?/, "\n").chomp + "\n"
end