better parsing of headings in mini-toc

we borked when there were trailing spaces after a closing heading tag