class Kramdown::Converter::HashAST

Converts a Kramdown::Document to a nested hash for further processing or debug output.

def convert(el)

def convert(el)
  hash = {type: el.type}
  hash[:attr] = el.attr unless el.attr.empty?
  hash[:value] = el.value unless el.value.nil?
  hash[:options] = el.options unless el.options.empty?
  unless el.children.empty?
    hash[:children] = []
    el.children.each {|child| hash[:children] << convert(child) }
  end
  hash
end