module Kramdown::Utils::Html

def entity_to_str(e, original = nil)

This method uses the option +entity_output+ to determine the output form for the entity.

original representation of the entity.
Convert the entity +e+ to a string. The optional parameter +original+ may contain the
def entity_to_str(e, original = nil)
  if RUBY_VERSION >= '1.9' && @options[:entity_output] == :as_char &&
      (c = e.char.encode(@root.options[:encoding]) rescue nil) && !ESCAPE_MAP.has_key?(c)
    c
  elsif (@options[:entity_output] == :as_input || @options[:entity_output] == :as_char) && original
    original
  elsif @options[:entity_output] == :numeric || e.name.nil?
    "&##{e.code_point};"
  else
    "&#{e.name};"
  end
end