Skip to content

Commit 061b9b5

Browse files
committed
Fix sidebar navigation for non-ASCII section headers
1 parent 86d8218 commit 061b9b5

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/main/js/util/dom.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@ export function createElementFromHtml(html) {
66

77
export function toId(string) {
88
const trimmed = string.trim();
9-
const ascii = trimmed.replace(/[\W_]+/g, "-").toLowerCase();
10-
11-
// If ASCII stripping produces something meaningful, keep old behavior
12-
if (ascii && ascii !== "-") {
13-
return ascii;
14-
}
15-
16-
// Fallback for non-ASCII locales (CJK, etc.)
179
return Array.from(trimmed)
18-
.map(c => c.codePointAt(0).toString(16))
10+
.map((c) => c.codePointAt(0).toString(16))
1911
.join("-");
2012
}

0 commit comments

Comments
 (0)