Who doesn’t know the problem with external links. You don’t want to expect target=”_blank” to your users so you let open links in the same window. To enable users to see that a link is external, you want to mark them. So a user can than decide to open it eventually in a new window/tab themselves.
I have seen multiple solutions for this problem. Some have been executed server-side, some of them used heavy JavaScript function client-side. Most of the time, the scripts searched for all links within a page to change them afterwards.