Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit f7e2193

Browse files
authored
Have the TOC script cleanup headers even more (#1385)
They will now also ignore leading and trailing hyphens as well as non-breaking spaces.
1 parent e09f78a commit f7e2193

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

assets/js/generate_toc_for_cms.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ function addTOC() {
1616
var header = $(this);
1717
var title = header.text();
1818
var header_id = title
19-
.replace(/[ :&\/\$]/g, "-")
19+
.replace(/[ \n\t:&\/\$\xa0()]/g, "-")
2020
.replace(/--+/g, "-")
21-
.replace(/[\?!,.\'\"]/g, "");
21+
.replace(/[\?!,.\'\"]|^-|-$/g, "");
2222
header.attr("id", header_id);
2323
toc +=
2424
'<li class="toc-li table-of-contents-' +

0 commit comments

Comments
 (0)