FIX: Generate unique IDs for non-Latin languages (#36)
This commit is contained in:
parent
26f4e45dc2
commit
c658e95d54
|
@ -32,10 +32,11 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
headings.forEach((h) => {
|
||||
headings.forEach((h, index) => {
|
||||
// suffix uses index for non-Latin languages
|
||||
const suffix = slugify(h.textContent) || index;
|
||||
const id =
|
||||
h.getAttribute("id") ||
|
||||
slugify(`toc-${h.nodeName}-${h.textContent}`);
|
||||
h.getAttribute("id") || slugify(`toc-${h.nodeName}-${suffix}`);
|
||||
|
||||
h.setAttribute("id", id);
|
||||
h.setAttribute("data-d-toc", id);
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue