{"id":13413554,"url":"https://github.com/gosimple/slug","last_synced_at":"2025-05-11T03:51:36.785Z","repository":{"id":15548823,"uuid":"18283807","full_name":"gosimple/slug","owner":"gosimple","description":"URL-friendly slugify with multiple languages support.","archived":false,"fork":false,"pushed_at":"2024-12-23T19:05:30.000Z","size":111,"stargazers_count":1238,"open_issues_count":9,"forks_count":111,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-08T17:17:59.060Z","etag":null,"topics":["go","slug"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gosimple.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":"2014-03-31T06:24:51.000Z","updated_at":"2025-05-08T15:57:51.000Z","dependencies_parsed_at":"2025-01-07T18:02:40.879Z","dependency_job_id":"84c00046-5b76-444b-ba5e-a57c62a289ab","html_url":"https://github.com/gosimple/slug","commit_stats":{"total_commits":101,"total_committers":35,"mean_commits":"2.8857142857142857","dds":"0.40594059405940597","last_synced_commit":"412e31ae7a86af09c88e2c68cd440108e69e24ab"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosimple%2Fslug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosimple%2Fslug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosimple%2Fslug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosimple%2Fslug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gosimple","download_url":"https://codeload.github.com/gosimple/slug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253437047,"owners_count":21908450,"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","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":["go","slug"],"created_at":"2024-07-30T20:01:43.055Z","updated_at":"2025-05-11T03:51:36.762Z","avatar_url":"https://github.com/gosimple.png","language":"Go","funding_links":[],"categories":["Natural Language Processing","自然语言处理","Text Processing","Go","Specific Formats","Microsoft Office","文本处理`解析和操作文本的代码库`","文本处理","Repositories","Bot Building","\u003cspan id=\"文字处理-text-processing\"\u003e文字处理 Text Processing\u003c/span\u003e"],"sub_categories":["Slugifiers","鼻涕虫","Advanced Console UIs","HTTP Clients","查询语","交流","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"# slug\n\nPackage `slug` generate slug from Unicode string, URL-friendly slugify with\nmultiple languages support.\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/gosimple/slug.svg)](https://pkg.go.dev/github.com/gosimple/slug)\n[![Tests](https://github.com/gosimple/slug/actions/workflows/tests.yml/badge.svg)](https://github.com/gosimple/slug/actions/workflows/tests.yml)\n[![codecov](https://codecov.io/gh/gosimple/slug/branch/master/graph/badge.svg?token=FT2kEZHQW7)](https://codecov.io/gh/gosimple/slug)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gosimple/slug?logo=github\u0026sort=semver)](https://github.com/gosimple/slug/releases)\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/gosimple/slug\"\n)\n\nfunc main() {\n\ttext := slug.Make(\"Hellö Wörld хелло ворлд\")\n\tfmt.Println(text) // Will print: \"hello-world-khello-vorld\"\n\n\tsomeText := slug.Make(\"影師\")\n\tfmt.Println(someText) // Will print: \"ying-shi\"\n\n\tenText := slug.MakeLang(\"This \u0026 that\", \"en\")\n\tfmt.Println(enText) // Will print: \"this-and-that\"\n\n\tdeText := slug.MakeLang(\"Diese \u0026 Dass\", \"de\")\n\tfmt.Println(deText) // Will print: \"diese-und-dass\"\n\n\tslug.Lowercase = false // Keep uppercase characters\n\tdeUppercaseText := slug.MakeLang(\"Diese \u0026 Dass\", \"de\")\n\tfmt.Println(deUppercaseText) // Will print: \"Diese-und-Dass\"\n\n\tslug.CustomSub = map[string]string{\n\t\t\"water\": \"sand\",\n\t}\n\ttextSub := slug.Make(\"water is hot\")\n\tfmt.Println(textSub) // Will print: \"sand-is-hot\"\n}\n```\n\n## Design\n\nThis library will always returns clean output from any Unicode string\ncontaining only the following ASCII characters:\n\n* numbers: `0-9`\n* small letters: `a-z`\n* big letters: `A-Z` (only if you set `Lowercase` to `false`)\n* minus sign: `-`\n* underscore: `_`\n\nMinus sign and underscore characters will never appear at the beginning or\nthe end of the returned string.\n\nThanks to context-insensitive transliteration of Unicode characters to ASCII\noutput returned string is safe for URL slugs and filenames.\n\n## Requests or bugs?\n\n\u003chttps://github.com/gosimple/slug/issues\u003e\n\nIf your language is missing you could add it in `languages_substitution.go`\nfile.\n\nIn case of missing proper Unicode characters transliteration to ASCII you could\nadd them to underlying library:\n\u003chttps://github.com/gosimple/unidecode\u003e.\n\n## Installation\n\n```shell\ngo get -u github.com/gosimple/slug\n```\n\n## Benchmarking\n\n```shell\ngo test -run=NONE -bench=. -benchmem -count=6 ./... \u003e old.txt\n# make changes\ngo test -run=NONE -bench=. -benchmem -count=6 ./... \u003e new.txt\n\ngo install golang.org/x/perf/cmd/benchstat@latest\n\nbenchstat old.txt new.txt\n```\n\n## License\n\nThe source files are distributed under the\n[Mozilla Public License, version 2.0](http://mozilla.org/MPL/2.0/),\nunless otherwise noted.\nPlease read the [FAQ](http://www.mozilla.org/MPL/2.0/FAQ.html)\nif you have further questions regarding the license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgosimple%2Fslug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgosimple%2Fslug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgosimple%2Fslug/lists"}