Files
tolaria/src/utils/noteSlug.ts
2026-04-25 23:08:30 +02:00

12 lines
369 B
TypeScript

// Shared title-to-stem slugging keeps frontend rename and wikilink behavior
// aligned with the backend rename pipeline.
export function slugifyNoteStem(text: string): string {
const result = text
.normalize('NFKC')
.toLocaleLowerCase()
.trim()
.replace(/[^\p{Letter}\p{Number}]+/gu, '-')
.replace(/(^-|-$)/g, '')
return result || 'untitled'
}