Improve anchor links to handle headings with HTML and duplicate heading names