Metadata-Version: 2.4
Name: nano-slug
Version: 0.1.1
Summary: Tiny text → URL slug converter in ~1KB (zero deps)
Author: ozgunlu
License: MIT
Project-URL: Homepage, https://github.com/ozgunlu/nano-slug
Project-URL: Issues, https://github.com/ozgunlu/nano-slug/issues
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# nano-slug
[![PyPI](https://img.shields.io/pypi/v/nano-slug.svg?color=blue)](https://pypi.org/project/nano-slug/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
![Size](https://img.shields.io/badge/size-~1KB-lightgrey.svg)
[![CI](https://github.com/ozgunlu/nano-slug/actions/workflows/ci.yml/badge.svg)](https://github.com/ozgunlu/nano-slug/actions)

Tiny **text → URL slug** converter — ~1 KB, zero deps.
Lowercases, strips accents, replaces whitespace/punct with `-`, collapses dashes. Perfect for code-golf, minimal containers, or just for fun.

---

## ✨ Features
- ✅ Unicode → ASCII (`Café au lait` → `cafe-au-lait`)
- ✅ Punctuation/whitespace → `-`, multi-dash collapse, trim ends
- ✅ Returns `slug` if result would be empty
- ✅ Zero dependencies • single tiny file • CLI included

---

## 🚀 Usage
```bash
# Local (from repo)
python app_min.py "Hello, World!"                        # hello-world
python app_min.py "Türkçe Çalışma — Şaşırtıcı!"          # turkce-calisma-sasirtici
```

After installing:

```bash
# CLI
pip install nano-slug
nano-slug "Café au lait"                                  # cafe-au-lait
echo "  multiple   spaces  " | nano-slug                  # multiple-spaces
```

---

## 🤓 Why so small?

- Pure stdlib: unicodedata (NFKD) + tiny re replacements
- No transliteration tables, no locale deps
- Single tiny file + tiny CLI: perfect for scripts, containers, CI.

---

## 🎉 Fun Ideas

- **Batch rename files**
```bash
for f in *.md; do mv "$f" "$(nano-slug "${f%.md}").md"; done
```
- **Make anchors for headings**
```bash
awk '/^#/{sub(/^#* /,""); cmd="nano-slug \""$0"\""; cmd | getline s; close(cmd); print "- ["$0"]( #"s")"}' README.md
```
- **Slug from git branch**
```bash
nano-slug "$(git rev-parse --abbrev-ref HEAD)"
```

---

> **Notes: ASCII-only output by design. Non-Latin scripts may collapse to empty → returns "slug".**

---

## 📜 License

MIT © 2025

