module Jekyll
  class OverlineFilter
    def self.apply_overline(content)
      content.gsub(/~([^~\s]+)~/, '<span class="overline">\1</span>')
    end
  end

  Hooks.register [:documents, :pages], :post_render do |item|
    if item.output_ext == ".html"
      item.output = OverlineFilter.apply_overline(item.output)
    end
  end
end

puts "✅ Overline plugin loaded!"
