From c219d2a4c32590f9a9d70158932ca9acd42fc981 Mon Sep 17 00:00:00 2001 From: StarHeartHunt Date: Wed, 11 Sep 2024 16:45:29 +0800 Subject: [PATCH] :bug: encode chinese chars in permalink --- packages/plugin-changelog/src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-changelog/src/utils.ts b/packages/plugin-changelog/src/utils.ts index 2e2991b..7e003aa 100644 --- a/packages/plugin-changelog/src/utils.ts +++ b/packages/plugin-changelog/src/utils.ts @@ -14,14 +14,14 @@ function getPaginator(chunks: Section[][], prevIdx: number, nextIdx: number) { if (prevIdx >= 0 && prevIdx < chunks.length) { const chunk = chunks?.[prevIdx]?.[0]; if (chunk) { - content += ` previous={{ title: "${chunk.title}", permalink: "/changelog/${chunk.title}" }}`; + content += ` previous={{ title: "${chunk.title}", permalink: "/changelog/${encodeURIComponent(chunk.title)}" }}`; } } if (nextIdx >= 0 && nextIdx < chunks.length) { const chunk = chunks?.[nextIdx]?.[0]; if (chunk) { - content += ` next={{ title: "${chunk.title}", permalink: "/changelog/${chunk.title}" }}`; + content += ` next={{ title: "${chunk.title}", permalink: "/changelog/${encodeURIComponent(chunk.title)}" }}`; } }