Getting started
Inspect the bundled documentation before running the utility in a local test project.
Compatibility and review
Use the demo with synthetic inputs and review its behavior in your own tools before adapting it.
Resource files
Inspect the original contents and download individual files.
export function toSlug(input) {
return String(input).normalize("NFKC").trim().toLowerCase()
.replace(/[^\p{Letter}\p{Number}\p{Mark}]+/gu, "-")
.replace(/^-+|-+$/g, "");
}
Unicode Slug Builder
Import toSlug from ./slug.mjs. Pass a text label and use the result as a readable URL segment after encoding it with encodeURIComponent. Handle empty results and collisions in your application.
ساخت شناسهٔ نشانی
تابع toSlug را از ./slug.mjs وارد کن و به آن یک عنوان بده. پیش از استفاده در نشانی، نتیجه را با encodeURIComponent کد کن. نتیجهٔ خالی و تداخل دو عنوان را در برنامه مدیریت کن.
MIT · Betavan demo.
Raw Markdown
# Unicode Slug Builder
Import toSlug from ./slug.mjs. Pass a text label and use the result as a readable URL segment after encoding it with encodeURIComponent. Handle empty results and collisions in your application.
## ساخت شناسهٔ نشانی
تابع toSlug را از ./slug.mjs وارد کن و به آن یک عنوان بده. پیش از استفاده در نشانی، نتیجه را با encodeURIComponent کد کن. نتیجهٔ خالی و تداخل دو عنوان را در برنامه مدیریت کن.
MIT · Betavan demo.