mindnet_obsidian/src/interview/slugify.ts
Lars bab84549e2
Some checks are pending
Node.js build / build (20.x) (push) Waiting to run
Node.js build / build (22.x) (push) Waiting to run
Enhance interview functionality and settings; add YAML dependency
- Introduced profile selection modal for creating notes from interview profiles.
- Added settings for interview configuration path, auto-starting interviews, and intercepting unresolved link clicks.
- Updated package files to include YAML dependency for configuration handling.
- Enhanced CSS for profile selection and interview wizard UI elements.
2026-01-16 12:27:44 +01:00

16 lines
504 B
TypeScript

/**
* Convert string to URL-safe slug (a-z0-9_).
* Used for file names.
*/
export function slugify(text: string): string {
if (!text) return "";
return text
.toLowerCase()
.normalize("NFD") // Decompose accented characters
.replace(/[\u0300-\u036f]/g, "") // Remove diacritics
.replace(/[^a-z0-9_]+/g, "_") // Replace non-alphanumeric with underscore
.replace(/^_+|_+$/g, "") // Remove leading/trailing underscores
.replace(/_+/g, "_"); // Collapse multiple underscores
}