{"id":13367156,"url":"https://github.com/Gosimple/slug","last_synced_at":"2025-03-12T18:31:59.297Z","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":1217,"open_issues_count":9,"forks_count":112,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-12T06:00:52.645Z","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-03-11T15:37:25.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":243271466,"owners_count":20264462,"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-30T00:01:39.996Z","updated_at":"2025-03-12T18:31:59.269Z","avatar_url":"https://github.com/gosimple.png","language":"Go","funding_links":[],"categories":["文本处理","文本處理"],"sub_categories":["高级控制台界面","高級控制台界面"],"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"}