Name | github-slugger JSON |
Version |
0.0.3
JSON |
| download |
home_page | |
Summary | Generate a slug just like GitHub does for markdown headings. (JavaScript Port) |
upload_time | 2022-12-12 09:15:24 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3 |
license | Copyright (c) 2015, Dan Flettre <fletd01@yahoo.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
keywords |
slug
heading
processor
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# github-slugger
[![Build][build-badge]][build]
[build-badge]: https://github.com/martinheidegger/github_slugger/workflows/main/badge.svg
[build]: https://github.com/martinheidegger/github_slugger/actions
> This is a Python Fork of the [JavaScript `github-slugger`][js] package
[js]: https://github.com/Flet/github-slugger
Generate 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.
This project is not a markdown or HTML parser: passing `alpha *bravo* charlie`
or `alpha <em>bravo</em> charlie` doesn’t work.
Instead pass the plain text value of the heading: `alpha bravo charlie`.
## Install
```
pip install github-slugger
```
## Usage
```python
from github_slugger import GithubSlugger
slugger = GithubSlugger()
slugger.slug('foo')
# returns 'foo'
slugger.slug('foo')
# returns 'foo-1'
slugger.slug('bar')
# returns 'bar'
slugger.slug('foo')
# returns 'foo-2'
slugger.slug('Привет non-latin 你好')
# returns 'привет-non-latin-你好'
slugger.slug('😄 emoji')
# returns '-emoji'
slugger.reset()
slugger.slug('foo')
# returns 'foo'
```
Check [`test/fixtures.json`](test/fixtures.json) for more examples.
If you need, you can also use the underlying implementation which does not keep
track of the previously slugged strings (not recommended):
```python
from github_slugger import slug
slug('foo bar baz')
# returns 'foo-bar-baz'
slug('foo bar baz')
# returns the same slug 'foo-bar-baz' because it does not keep track
```
## Contributing
Contributions welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.
## License
[ISC](LICENSE)
Raw data
{
"_id": null,
"home_page": "",
"name": "github-slugger",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "slug,heading,processor",
"author": "",
"author_email": "Dan Flettre <flettre@gmail.com>, Titus Wormer <tituswormer@gmail.com>, Martin Heidegger <martin.heidegger@gmail.comn>",
"download_url": "https://files.pythonhosted.org/packages/fe/e9/c3fcf0d020dd1911c02f7c6b75e9ff809252c423dd4c3bcf8f1b0b86bf31/github-slugger-0.0.3.tar.gz",
"platform": null,
"description": "# github-slugger\n\n[![Build][build-badge]][build]\n\n[build-badge]: https://github.com/martinheidegger/github_slugger/workflows/main/badge.svg\n[build]: https://github.com/martinheidegger/github_slugger/actions\n\n> This is a Python Fork of the [JavaScript `github-slugger`][js] package\n\n[js]: https://github.com/Flet/github-slugger\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 <em>bravo</em> charlie` doesn\u2019t work.\nInstead pass the plain text value of the heading: `alpha bravo charlie`.\n\n## Install\n\n```\npip install github-slugger\n```\n\n## Usage\n\n```python\nfrom github_slugger import GithubSlugger\n\nslugger = 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('\u041f\u0440\u0438\u0432\u0435\u0442 non-latin \u4f60\u597d')\n# returns '\u043f\u0440\u0438\u0432\u0435\u0442-non-latin-\u4f60\u597d'\n\nslugger.slug('\ud83d\ude04 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```python\nfrom github_slugger import slug\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",
"bugtrack_url": null,
"license": "Copyright (c) 2015, Dan Flettre <fletd01@yahoo.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ",
"summary": "Generate a slug just like GitHub does for markdown headings. (JavaScript Port)",
"version": "0.0.3",
"split_keywords": [
"slug",
"heading",
"processor"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d419807df596f60eb24b3421079757e1",
"sha256": "2d531ff0e439762900bf0ec3be10771b1d3635a6d4486113f1352fa19c091a91"
},
"downloads": -1,
"filename": "github_slugger-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d419807df596f60eb24b3421079757e1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3",
"size": 8491,
"upload_time": "2022-12-12T09:15:21",
"upload_time_iso_8601": "2022-12-12T09:15:21.845425Z",
"url": "https://files.pythonhosted.org/packages/31/41/0cfe9970e00c3e9470a5ab559d27a5320695f553b7c240b3933ddf7e9825/github_slugger-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "64fa4563ea1ecc6132be20d181b0b776",
"sha256": "e607450e8568c0c1b9a41f5748f422e5a22c1d9799d52bc6dd6575397c1ccb22"
},
"downloads": -1,
"filename": "github-slugger-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "64fa4563ea1ecc6132be20d181b0b776",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 7720,
"upload_time": "2022-12-12T09:15:24",
"upload_time_iso_8601": "2022-12-12T09:15:24.989589Z",
"url": "https://files.pythonhosted.org/packages/fe/e9/c3fcf0d020dd1911c02f7c6b75e9ff809252c423dd4c3bcf8f1b0b86bf31/github-slugger-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-12 09:15:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "github-slugger"
}