I wrote a small gist which I think can be very helpful to anybody seeking a solution to that problem: external link
What it does is it adds target="_blank" attributes to anchor elements that would link to a domain different than the current one.
You can patch it up to whatever you see fit.