Tiny text → URL slug converter in ~1KB (zero deps)
Project description
nano-slug
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
slugif result would be empty - ✅ Zero dependencies • single tiny file • CLI included
🚀 Usage
# 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:
# 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
for f in *.md; do mv "$f" "$(nano-slug "${f%.md}").md"; done
- Make anchors for headings
awk '/^#/{sub(/^#* /,""); cmd="nano-slug \""$0"\""; cmd | getline s; close(cmd); print "- ["$0"]( #"s")"}' README.md
- Slug from git branch
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nano_slug-0.1.0.tar.gz.
File metadata
- Download URL: nano_slug-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf76456ff6d4d48c4c9a4a6b608a63a90e3466769d36cb48e73aa839f09737a8
|
|
| MD5 |
11b728588033356221e1067b83fe6aec
|
|
| BLAKE2b-256 |
fd924f269dc5630d8714421cb40a4e442361ded19406e0aee8a955c7df91ad0d
|
File details
Details for the file nano_slug-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nano_slug-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70af25286957de123d8ec2af5ec26608e5a64dbb5f7ec7a38f6d184753969b27
|
|
| MD5 |
2ee7d7d271e3fe671d22709d5dc5867a
|
|
| BLAKE2b-256 |
a005f47653586c8393ff2bf5c4f3bf44b3ff628ac41679b09ba1e12d001f56a6
|