Support Unicode capture slugs

This commit is contained in:
Codex
2026-07-13 03:25:11 +00:00
parent 3ed933fb35
commit 2020f8e356
3 changed files with 30 additions and 5 deletions
+5 -4
View File
@@ -5,12 +5,13 @@ export function slugify(input: string, fallback = "chatgpt-share"): string {
.normalize("NFKD")
.replace(STOP_CHARS, "")
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/[^\p{L}\p{N}]+/gu, "-")
.replace(/^-+|-+$/g, "")
.replace(/-{2,}/g, "-")
.slice(0, 80);
.replace(/-{2,}/g, "-");
return base || fallback;
const truncated = Array.from(base).slice(0, 80).join("").replace(/-+$/g, "");
return truncated || fallback;
}
export function displayTitleFromSlug(slug: string): string {