https://github.com/floatpane/go-emoji-shortcode
Shortcode Unicode emoji library for Go
https://github.com/floatpane/go-emoji-shortcode
Last synced: about 2 months ago
JSON representation
Shortcode Unicode emoji library for Go
- Host: GitHub
- URL: https://github.com/floatpane/go-emoji-shortcode
- Owner: floatpane
- License: mit
- Created: 2026-06-22T09:28:07.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2026-06-22T09:46:12.000Z (about 2 months ago)
- Last Synced: 2026-06-22T11:21:11.127Z (about 2 months ago)
- Language: Go
- Homepage: https://emoji.floatpane.com
- Size: 139 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# go-emoji-shortcode
[](https://golang.org)
[](https://pkg.go.dev/github.com/floatpane/go-emoji-shortcode)
[](https://github.com/floatpane/go-emoji-shortcode/actions/workflows/ci.yml)
[](LICENSE)
A small, dependency-free Go library for mapping emoji shortcodes (`:smile:`, `:heart:`, ...) to Unicode emoji characters. It is designed for text editors and TUI composers that want live shortcode preview and suggestion support.
Extracted from [matcha](https://github.com/floatpane/matcha) so it can be reused by other Go projects.
## Install
```bash
go get github.com/floatpane/go-emoji-shortcode
```
Requires Go 1.26+.
## Usage
```go
package main
import (
"fmt"
"github.com/floatpane/go-emoji-shortcode"
)
func main() {
e, ok := shortcode.Lookup("smile")
if ok {
fmt.Println(e) // 😄
}
matches := shortcode.Suggest("sm")
for _, m := range matches {
fmt.Printf("%s -> %s\n", m.Code, m.Emoji)
}
}
```
## API
- `Lookup(shortcode string) (emoji string, ok bool)` — exact shortcode to emoji.
- `Suggest(prefix string) []Match` — fuzzy-matched suggestions for a prefix (e.g. `"sm"` matches `:smile:`, `:smirk:`, ...). Results are sorted by relevance.
- `All() []Match` — every known shortcode/emoji pair.
## Documentation
Full API reference: [pkg.go.dev/github.com/floatpane/go-emoji-shortcode](https://pkg.go.dev/github.com/floatpane/go-emoji-shortcode)
## Contributing
PRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
## License
MIT. See [LICENSE](LICENSE).