fix some potential invalid markup in TOC rendering