class Kramdown::Parser::Html::ElementConverter

def is_simple_table?(el)

def is_simple_table?(el)
  only_phrasing_content = lambda do |c|
    c.children.all? do |cc|
      (cc.type == :text || !HTML_BLOCK_ELEMENTS.include?(cc.value)) && only_phrasing_content.call(cc)
    end
  end
  check_cells = Proc.new do |c|
    if c.value == 'th' || c.value == 'td'
      return false if !only_phrasing_content.call(c)
    else
      c.children.each {|cc| check_cells.call(cc)}
    end
  end
  check_cells.call(el)
  check_rows = lambda do |t, type|
    t.children.all? {|r| (r.value == 'tr' || r.type == :text) && r.children.all? {|c| c.value == type || c.type == :text}}
  end
  check_rows.call(el, 'td') ||
    (el.children.all? do |t|
       t.type == :text || (t.value == 'thead' && check_rows.call(t, 'th')) ||
         ((t.value == 'tfoot' || t.value == 'tbody') && check_rows.call(t, 'td'))
     end && el.children.any? {|t| t.value == 'tbody'})
end