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)
  entity_output = @options[:entity_output]
  if e.char.respond_to?(:encoding) && entity_output == :as_char &&
      (c = e.char.encode(@root.options[:encoding]) rescue nil) &&
      ((c = e.char) == '"' || !ESCAPE_MAP.has_key?(c))
    c
  elsif (entity_output == :as_input || entity_output == :as_char) && original
    original
  elsif (entity_output == :symbolic || ESCAPE_MAP.has_key?(e.char)) && !e.name.nil?
    "&#{e.name};"
  else # default to :numeric
    "&##{e.code_point};"
  end
end