{"id":13483991,"url":"https://github.com/Flet/github-slugger","last_synced_at":"2025-03-27T15:30:53.331Z","repository":{"id":47546621,"uuid":"42958503","full_name":"Flet/github-slugger","owner":"Flet","description":":octocat: Generate a slug just like GitHub does for markdown headings.","archived":false,"fork":false,"pushed_at":"2023-09-30T07:31:44.000Z","size":140,"stargazers_count":344,"open_issues_count":0,"forks_count":33,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T20:37:48.742Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2015-09-22T20:18:01.000Z","updated_at":"2024-09-16T13:11:16.000Z","dependencies_parsed_at":"2024-01-13T18:24:37.314Z","dependency_job_id":"2db8f783-ad0a-4fff-ad56-06039df4fd72","html_url":"https://github.com/Flet/github-slugger","commit_stats":{"total_commits":65,"total_committers":12,"mean_commits":5.416666666666667,"dds":0.4769230769230769,"last_synced_commit":"3461c4350868329c8530904d170358bca1d31448"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flet%2Fgithub-slugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flet%2Fgithub-slugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flet%2Fgithub-slugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flet%2Fgithub-slugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flet","download_url":"https://codeload.github.com/Flet/github-slugger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245871728,"owners_count":20686252,"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":[],"created_at":"2024-07-31T17:01:17.711Z","updated_at":"2025-03-27T15:30:52.102Z","avatar_url":"https://github.com/Flet.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"readme":"# github-slugger\n\n[![npm][npm-image]][npm-url]\n[![Build][build-badge]][build]\n\n[npm-image]: https://img.shields.io/npm/v/github-slugger.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/github-slugger\n[build-badge]: https://github.com/Flet/github-slugger/workflows/main/badge.svg\n[build]: https://github.com/Flet/github-slugger/actions\n\nGenerate a slug just like GitHub does for markdown headings. It also ensures slugs are unique in the same way GitHub does it. The overall goal of this package is to emulate the way GitHub handles generating markdown heading anchors as close as possible.\n\nThis project is not a markdown or HTML parser: passing `alpha *bravo* charlie`\nor `alpha \u003cem\u003ebravo\u003c/em\u003e charlie` doesn’t work.\nInstead pass the plain text value of the heading: `alpha bravo charlie`.\n\n## Install\n\n```\nnpm install github-slugger\n```\n\n## Usage\n\n```js\nimport GithubSlugger from 'github-slugger'\n\nconst slugger = new GithubSlugger()\n\nslugger.slug('foo')\n// returns 'foo'\n\nslugger.slug('foo')\n// returns 'foo-1'\n\nslugger.slug('bar')\n// returns 'bar'\n\nslugger.slug('foo')\n// returns 'foo-2'\n\nslugger.slug('Привет non-latin 你好')\n// returns 'привет-non-latin-你好'\n\nslugger.slug('😄 emoji')\n// returns '-emoji'\n\nslugger.reset()\n\nslugger.slug('foo')\n// returns 'foo'\n```\n\nCheck [`test/fixtures.json`](test/fixtures.json) for more examples.\n\nIf you need, you can also use the underlying implementation which does not keep\ntrack of the previously slugged strings (not recommended):\n\n```js\nimport GithubSlugger, {slug} from 'github-slugger'\n\nslug('foo bar baz')\n// returns 'foo-bar-baz'\n\nslug('foo bar baz')\n// returns the same slug 'foo-bar-baz' because it does not keep track\n```\n\n## Contributing\n\nContributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.\n\n## License\n\n[ISC](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlet%2Fgithub-slugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFlet%2Fgithub-slugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFlet%2Fgithub-slugger/lists"}