Skip to content

Missing option to process urls before building href attribute

Right now, there's an option to process a mention (mention_handler), however nothing that allows processing urls before they're built into the anchor tag.

This is useful for sites that want to handle redirects themselves via exit links. For example, a website that's getting linkified (say, "google.com") could be transformed to "https://mysite.com/redirect?to=https%3A%2F%2Fgoogle.com" when the following function is passed to href_handler:

def handle_href(href) do
  Routes.external_link_url(MyApp.Endpoint, :index, to: href)
end

I've implemented this in Linkify.Builder already, if this makes sense for this project I can open a PR!