Pandoc External Link Filter

This lua filter for pandoc sets a link’s rel attribute to external, if it starts with http:

function Link(element)
    if element.target:find("http", 1, true) == 1 then
        element.attributes.rel = "external"
    end
    return element
end

Add it to your pandoc’s parameters:

pandoc --lua-filter=externalLink.lua in.md -o out.html

You can then style those links via CSS like so:

a[rel~="external"]:after {
    content: " ↗";
}