Skip to content

Commit 05bbf5b

Browse files
author
Lysssyo
committed
modify config
1 parent 49d9bf2 commit 05bbf5b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

docs/.vitepress/config.mts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ md.renderer.rules.link_open = function (tokens, idx, options, env, self) {
192192
const [path, hash] = url.split('#');
193193

194194
if (hash) {
195-
const decoded = decodeURIComponent(hash);
195+
let decoded = hash;
196+
try {
197+
decoded = decodeURIComponent(hash);
198+
} catch (e) {
199+
console.warn(`[VitePress] Malformed URI in hash: ${hash} at ${pageData.relativePath}`);
200+
}
196201

197202
// 使用与上面 anchor.slugify 完全一致的逻辑处理链接
198203
let newHash = decoded

0 commit comments

Comments
 (0)