diff options
| author | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-14 22:15:14 +0100 |
|---|---|---|
| committer | Alex Pooley (@zuedev) <zuedev@gmail.com> | 2026-05-14 22:15:14 +0100 |
| commit | c4488b1c19d7e82c078d78c12d42894fd9be2173 (patch) | |
| tree | 82c049e208fa29c13fc481d885c5cc5b85fbc145 | |
| parent | 706d9c10c343955ac6ae107204c6d2b2a0bec80c (diff) | |
| download | unnamed-group-c4488b1c19d7e82c078d78c12d42894fd9be2173.tar unnamed-group-c4488b1c19d7e82c078d78c12d42894fd9be2173.tar.gz unnamed-group-c4488b1c19d7e82c078d78c12d42894fd9be2173.tar.bz2 unnamed-group-c4488b1c19d7e82c078d78c12d42894fd9be2173.tar.xz unnamed-group-c4488b1c19d7e82c078d78c12d42894fd9be2173.zip | |
dynamic ids to each header
| -rw-r--r-- | communities/red-right-hand/174bg.net/public/handbook/index.html | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/communities/red-right-hand/174bg.net/public/handbook/index.html b/communities/red-right-hand/174bg.net/public/handbook/index.html index 69140d2..ab992bd 100644 --- a/communities/red-right-hand/174bg.net/public/handbook/index.html +++ b/communities/red-right-hand/174bg.net/public/handbook/index.html @@ -596,6 +596,13 @@ headings.forEach((heading) => { const level = parseInt(heading.tagName[1]); + if (!heading.id) { + heading.id = heading.textContent + .trim() + .toLowerCase() + .replace(/[^\w\s-]/g, "") + .replace(/\s+/g, "-"); + } const tocLink = document.createElement("a"); tocLink.textContent = heading.textContent; tocLink.href = `#${heading.id}`; |
