fix anchors in TOC for headings with 2+ spaces

For example, "Sample acceptance test" produces anchor name "#Sample-acceptance test" which is incorrect, so links don't work.
Old `replace()` replaced only the first space character.