fix(docs): use replaceAll in the doc-section TOC slug helper
Satisfies unicorn/prefer-string-replace-all (global-regex replace -> replaceAll).
This commit is contained in:
@@ -32,8 +32,8 @@ function buildDocToc() {
|
|||||||
if (!h.id) {
|
if (!h.id) {
|
||||||
h.id = (h.textContent ?? '')
|
h.id = (h.textContent ?? '')
|
||||||
.toLowerCase().trim()
|
.toLowerCase().trim()
|
||||||
.replace(/[^a-z0-9]+/g, '-')
|
.replaceAll(/[^a-z0-9]+/g, '-')
|
||||||
.replace(/(^-|-$)/g, '');
|
.replaceAll(/(^-|-$)/g, '');
|
||||||
}
|
}
|
||||||
return { id: h.id, text: h.textContent ?? '', depth: h.tagName === 'H2' ? 2 : 3 };
|
return { id: h.id, text: h.textContent ?? '', depth: h.tagName === 'H2' ? 2 : 3 };
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user