Metadata-Version: 2.1
Name: github-slugger
Version: 0.0.3
Summary: Generate a slug just like GitHub does for markdown headings. (JavaScript Port)
Author-email: Dan Flettre <flettre@gmail.com>, Titus Wormer <tituswormer@gmail.com>, Martin Heidegger <martin.heidegger@gmail.comn>
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.
        
Project-URL: Homepage, https://github.com/martinheidegger/github_slugger
Project-URL: Bug Tracker, https://github.com/martinheidegger/github_slugger/issues
Keywords: slug,heading,processor
Classifier: Development Status :: 4 - Beta
Classifier: Topic :: Text Processing :: General
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: ISC License (ISCL)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown
License-File: LICENSE

# 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)
