{"id":18455479,"url":"https://github.com/danielhaim1/slugify","last_synced_at":"2025-10-12T05:49:54.171Z","repository":{"id":100607102,"uuid":"565830176","full_name":"danielhaim1/slugify","owner":"danielhaim1","description":"An all-purpose slug generator that converts text into clean, SEO-friendly slugs. It's ideal for automating anchor IDs in headings and is designed to handle a wide range of languages and special characters.","archived":false,"fork":false,"pushed_at":"2025-09-18T06:58:10.000Z","size":4021,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-18T08:43:01.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielhaim1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-14T12:20:22.000Z","updated_at":"2025-09-18T06:58:13.000Z","dependencies_parsed_at":"2024-09-29T06:17:24.059Z","dependency_job_id":null,"html_url":"https://github.com/danielhaim1/slugify","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danielhaim1/slugify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fslugify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fslugify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fslugify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fslugify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielhaim1","download_url":"https://codeload.github.com/danielhaim1/slugify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhaim1%2Fslugify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010335,"owners_count":26084738,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T08:08:09.208Z","updated_at":"2025-10-12T05:49:54.165Z","avatar_url":"https://github.com/danielhaim1.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multilang Slugify\n\n[![npm version](https://img.shields.io/npm/v/@danielhaim/slugify)](https://www.npmjs.com/package/@danielhaim/slugify)\n[![Downloads](https://img.shields.io/npm/dt/@danielhaim/slugify.svg)](https://www.npmjs.com/package/@danielhaim/slugify)\n![GitHub](https://img.shields.io/github/license/danielhaim1/slugify)\n\nSlugify is an all-purpose slug generator that converts text into clean, SEO-friendly slugs. It's ideal for automating anchor IDs in headings and is designed to handle a wide range of languages and special characters.\n\n## Demo\n\n\n\u003ca target=\"_blank\" href=\"https://codepen.io/danielhaim/pen/NWJgNVN\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/danielhaim1/slugify/6f6b35928ab0b6cd69e3b0cb1e2d3062c6b3e05d/demo/demo.png\" width=\"100%\" height=\"auto\" alt=\"Multilang Slugify Demo\"\u003e\n\u003c/a\u003e\n\n------------\n\n## Supported Languages\n\nSlugify supports a diverse set of languages:\n\nGerman, Danish, Dutch, Finnish, French, Hungarian, Italian, Norwegian, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish, Greek, Bulgarian, Serbian, Croatian, Czech, Polish, Slovak, Slovenian, Latvian, Lithuanian, Estonian, Persian, Arabic, Hebrew, Hindi, Thai, Chinese, Japanese, Korean, Vietnamese, and Ukrainian, as well as Emoji\n\n\n## Installation\n\nYou can install this module via npm:\n\n```bash\n$ npm i @danielhaim/slugify\n```\n\n## NPM\n\n```js\nimport { slugify } from './path/to/slugify/index.js';\n\nconst slugifier = new slugify();\nconsole.log(slugifier.generate(\"Hello World!\")); // returns \"hello-world\"\n```\n\n------------\n\n## Examples\n\n### Headings with IDs\n\nInput:\n\n```html\n\u003ch1\u003e\u003cspan\u003eHow will mobile commerce impact 2022?\u003c/span\u003e\u003c/h1\u003e\n\u003ch2\u003e\u003cspan\u003eSophia, Ärztin aus Hamburg\u003c/span\u003e\u003c/h2\u003e\n\u003ch2\u003e\u003cspan\u003eSüße Sophia, schön und klug\u003c/span\u003e\u003c/h2\u003e\n```\n\n```js\n// Function to generate slugs\nfunction generateSlug(titleElement) {\n  const titleContent = titleElement.textContent || '';\n  const slugifier = new slugify();\n  const slugged = slugifier.generate(titleContent);\n  return slugged;\n}\n\n// Select all heading elements (h1, h2, h3, etc.)\nconst headingElements = document.querySelectorAll('h1, h2, h3, h4, h5, h6');\n\nheadingElements.forEach((headingElement) =\u003e {\n  const slugged = generateSlug(headingElement);\n\n  // Only set the ID and create \u003ca\u003e if a valid slug is generated\n  if (slugged) {\n    const anchorElement = document.createElement('a');\n    anchorElement.href = `#${slugged}`;\n    anchorElement.textContent = headingElement.textContent;\n    headingElement.innerHTML = ''; // Clear existing content\n    headingElement.appendChild(anchorElement);\n  }\n});\n```\n\nOutput:\n\n```html\n\u003ch1\u003e\u003ca href=\"#how-will-mobile-commerce-impact-2022\"\u003e\u003cspan\u003eHow will mobile commerce impact 2022?\u003c/span\u003e\u003c/a\u003e\u003c/h1\u003e\n\u003ch2\u003e\u003ca href=\"#sophia-aerztin-aus-hamburg\"\u003e\u003cspan\u003eSophia, Ärztin aus Hamburg\u003c/span\u003e\u003c/a\u003e\u003c/h2\u003e\n\u003ch2\u003e\u003ca href=\"#suesse-sophia-schoen-und-klug\"\u003e\u003cspan\u003eSüße Sophia, schön und klug\u003c/span\u003e\u003c/a\u003e\u003c/h2\u003e\n```\n\n### German special characters\n\n```js\nconst slugifier = new slugify();\n\nslugifier.generate('Ist dein Name Sophia?'); // Output: \"ist-dein-name-sophia\"\nslugifier.generate('Sophia, Ärztin aus Hamburg'); // Output: \"sophia-aerztin-aus-hamburg\"\nslugifier.generate('Wie geht es dir, Sophia?'); // Output: \"wie-geht-es-dir-sophia\"\nslugifier.generate('Süße Sophia, schön und klug'); // Output: \"suesse-sophia-schoen-und-klug\"\nslugifier.generate(\"Sophia's Geburtstag\"); // Output: \"sophias-geburtstag\"\n```\n\n### Additional examples with special characters and delimiters\n\n```js\nconst slugifier = new slugify();\n\nslugifier.generate('Hello, world!'); // Output: \"hello-world\"\nslugifier.generate('Hello, world!'); // Output: \"hello_world\"\nslugifier.generate('Hello, world!'); // Output: \"hello-world\"\n\nslugifier.generate('#1 Best in Class'); // Output: \"number-1-best-in-class\"\nslugifier.generate('hello@example.com'); // Output: \"hello-at-example-com\"\n```\n\n## Build Process\n\n```bash\n$ npm run build\n```\n\n## Test\n\n```bash\n$ npm run test\n```\n\n## Report Bugs\n\nIf you encounter any bugs or issues while using the library, please report them by opening a new issue in the repository's issue tracker. \n\nWhen reporting a bug, please provide as much detail as possible, including the steps to reproduce the issue and any error messages that you see. I appreciate any contribution to improving this library.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhaim1%2Fslugify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielhaim1%2Fslugify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhaim1%2Fslugify/lists"}