class Kramdown::Converter::Kramdown

def ial_for_element(el)

Return the IAL containing the attributes of the element +el+.
def ial_for_element(el)
  res = el.attr.map do |k, v|
    next if [:img, :a].include?(el.type) && ['href', 'src', 'alt', 'title'].include?(k)
    next if el.type == :header && k == 'id' && !v.strip.empty?
    if v.nil?
      ''
    elsif k == 'class' && !v.empty? && !v.index(/[.#]/)
      " " + v.split(/\s+/).map {|w| ".#{w}" }.join(" ")
    elsif k == 'id' && !v.strip.empty?
      " ##{v}"
    else
      " #{k}=\"#{v}\""
    end
  end.compact.join
  res = "toc" + (res.strip.empty? ? '' : " #{res}") if (el.type == :ul || el.type == :ol) &&
    el.options.dig(:ial, :refs)&.include?('toc')
  res = "footnotes" + (res.strip.empty? ? '' : " #{res}") if (el.type == :ul || el.type == :ol) &&
    el.options.dig(:ial, :refs)&.include?('footnotes')
  if el.type == :dl && el.options[:ial] && el.options[:ial][:refs]
    auto_ids = el.options[:ial][:refs].select {|ref| ref.start_with?('auto_ids') }.join(" ")
    res = auto_ids << (res.strip.empty? ? '' : " #{res}") unless auto_ids.empty?
  end
  res.strip.empty? ? nil : "{:#{res}}"
end