Rewrite internal links to anchors