Improve TOC and section link handling