:sushi: emoji terminal output for golang

Emoji

Emoji is a simple golang package.

wercker status Coverage Status GoDoc

Get it:

go get github.com/kyokomi/emoji/v2

Import it:

import (
	"github.com/kyokomi/emoji/v2"
)

Usage

package main

import (
	"fmt"

	"github.com/kyokomi/emoji/v2"
)

func main() {
	fmt.Println("Hello World Emoji!")

	emoji.Println(":beer: Beer!!!")

	pizzaMessage := emoji.Sprint("I like a :pizza: and :sushi:!!")
	fmt.Println(pizzaMessage)
}

Demo

demo

Reference

License

MIT

Owner
Comments
  • add go mod support

    add go mod support

    Even if this package doesn't have any dependencies, it's still a nice thing to have, at least for avoiding the v2.2.2+incompatible when importing.

    This is a double go.mod setup to avoid having the generator dependencies pulled when simply importing the package.

  • Emoji table is broken in 2.2.0

    Emoji table is broken in 2.2.0

    For example, between 2.1.0 and 2.2.0,

    -	":smile:":                                 "\U0001f604",
    +	":smile:":                                 "\u0001f604",
    

    but \u takes 4 digits while \U took 8, so this string is now "\u0001" + "f604", not an emoji character.

  • missing glyphs or...

    missing glyphs or...

    Hello,

    I'd like to use emojis in Hugo, but when I execute hello.go test file in the terminal I get the following:

    Hello World Emoji!
    🍺  Beer!!!
    I like a 🍕  and 🍣 !!
    

    so I wonder if some font has to be installed in order to get proper glyphs displayed?

  • [request] Update the emoji codemap for the latest unicode v14.0

    [request] Update the emoji codemap for the latest unicode v14.0

    Hello,

    Can you please update the emoji code map in this package so that it uses all the latest emojis.

    I am using this package through Hugo (https://gohugo.io).

    Thanks!

  • Remove padding

    Remove padding

    @kyokomi What is the purpose of ReplacePadding? If you have an emoji with a skin tone it currently renders like this: image

    Removing this fixes the issue but I don't want to cause any unwanted side affects

  • v2.0.0 has more errors and maybe less complete than v1.5.1

    v2.0.0 has more errors and maybe less complete than v1.5.1

    While it is good that Issue #20 expressed the desire to have a more up-to-date and more complete emoji list, the update to emojo_v5 in PR #27 for v2.0.0 has actually introduced errors and caused some regressions which deter users from upgrading to v2.0.0 and instead opting to stay with v1.5.1.

    The emoji-v5.json from CodeFreezr/emojo_v5, as is right now, contains errors:

    1. CodeFreezr/emojo#2 — "Tags": "#ERROR!" in all 6 "thumbs up" emojis
    2. CodeFreezr/emojo#3 — Two emojis with "" (empty string) as shortcode
    3. Since only one shortcode is listed per emoji, popular shortcodes like :+1: :+1: and :-1: :-1: are not in the list.

    The error CodeFreezr/emojo#3 crept into your emoji code map, e.g.:

    // Mapping from character to concrete escape code.
    var emojiCodeMap = map[string]string{
    	"::":                                "\U0001f590",
    

    when v1.5.1 had

    	":raised_hand_with_fingers_splayed:":     "\U0001f590",
    

    With :+1:, :-1:, :email: and perhaps more emoji shortcodes from v1.5.1 no longer in v2.0.0, users who have written content (e.g. blog posts) with these shortcodes in the past would see their content broken after upgrading to v2.0.0. That may be the reason why Hugo (the static website generator) is sticking with v1.5.1 and not upgrading to v2.0.0.

    So, yes, it could be quite a bit of work to do so, but it would be really nice if a future updates could maintain compatibility with v1.5.1 while including new emojis from v5 or even v11 or v12.

    Many thanks for your kind consideration!

  • Added vomiting emoji to codemap

    Added vomiting emoji to codemap

    I have added new emoji to the codemap. This emoji isn't in the cheat sheet, however sometimes it can be useful :) Do you allow emojis that are not part of the cheat sheet, but have the unicode point defined?

  • Support GitHub custom emoji?

    Support GitHub custom emoji?

    Hi kyokomi,

    It seams the emojis are mapped to unicode. Some custom emojis of GitHub are missing, like :octocat: :neckbeard: ... Is it possible to support these custom emoji, generated from image?https://github.com/github/gemoji/tree/master/images

  • I'm getting many question marks..

    I'm getting many question marks..

    I think that some of the emojis I try to convert using the emoji library are being converted to question marks.

    Any chance it happens as a result of the emojis that comes with iOS 10 maybe?

  • Could you add LICENSE file?

    Could you add LICENSE file?

  • High init costs

    High init costs

    While testing the new init cost debugging output in go 1.16, I found that emoji has one of the higher memory init costs in Hugo's dependencies.

    An an example, these are the init costs while running hugo version (which doesn't call into emoji):

    $ GODEBUG=inittrace=1 go run . version 2>&1 | rg emoji
    init github.com/kyokomi/emoji @15 ms, 3.9 ms clock, 783480 bytes, 3093 allocs
    

    By deferring the emojiMap population until needed, emoji's init costs can be greatly reduced:

    $ GODEBUG=inittrace=1 go run . version 2>&1 | rg emoji
    init github.com/kyokomi/emoji @21 ms, 0.009 ms clock, 2824 bytes, 30 allocs
    

    I have a branch with these changes. I can submit a PR if you're interested.

  • How could I convert emoji string to emoji icons and vice versa?

    How could I convert emoji string to emoji icons and vice versa?

    How could I convert emoji string to emoji icons and vice versa? For e.g.

    msg := "😀 😃 😄 😁 😆 😅 😂 🤣 \U0001F972 😊 😇 :plus:"
    

    I wanted to convert \U0001F972 and :plus: to emojis Also I could convert emojis to \U0001F972 or :plus: format

    I could convert :plus: to Emoji and Unicode strings like \U0001F972 OR I could convert \U0001F972 to :some string: and Emoji OR I could convert Emoji to :plus: or \U0001F972

A minimalistic emoji package for Go (golang)

emoji ?? ?? ?? emoji is a minimalistic emoji library for Go. It lets you use emoji characters in strings. Inspired by spatie/emoji Install ?? go get g

Dec 14, 2022
'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.
'go test' runner with output optimized for humans, JUnit XML for CI integration, and a summary of the test results.

gotestsum gotestsum runs tests using go test --json, prints formatted test output, and a summary of the test run. It is designed to work well for both

Dec 28, 2022
:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.
:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.

$ qrcp Transfer files over Wi-Fi from your computer to a mobile device by scanning a QR code without leaving the terminal. You can support development

Dec 28, 2022
A markdown renderer package for the terminal
A markdown renderer package for the terminal

go-term-markdown go-term-markdown is a go package implementing a Markdown renderer for the terminal. Note: Markdown being originally designed to rende

Nov 25, 2022
Glow is a terminal based markdown reader designed from the ground up to bring out the beauty—and power—of the CLI.💅🏻
Glow is a terminal based markdown reader designed from the ground up to bring out the beauty—and power—of the CLI.💅🏻

Glow Render markdown on the CLI, with pizzazz! What is it? Glow is a terminal based markdown reader designed from the ground up to bring out the beaut

Dec 30, 2022
a simple and lightweight terminal text editor written in Go

Simple Text editor written in Golang build go build main.go

Oct 4, 2021
Note - A text editor for the Linux Terminal! (Mainly compatible with Arch, because I made it on there)
Note - A text editor for the Linux Terminal! (Mainly compatible with Arch, because I made it on there)

Note - A text editor for the Linux Terminal! (Mainly compatible with Arch, because I made it on there)

Dec 7, 2022
A terminal based preview tool for markdown 🍪
A terminal based preview tool for markdown 🍪

Smooth Smooth is a terminal based preview tool for markdown. Features Turning: turn next/previous slide Scroll: scroll up/down slide Search: search wo

May 22, 2022
[Crawler/Scraper for Golang]🕷A lightweight distributed friendly Golang crawler framework.一个轻量的分布式友好的 Golang 爬虫框架。

Goribot 一个分布式友好的轻量的 Golang 爬虫框架。 完整文档 | Document !! Warning !! Goribot 已经被迁移到 Gospider|github.com/zhshch2002/gospider。修复了一些调度问题并分离了网络请求部分到另一个仓库。此仓库会继续

Oct 29, 2022
golang 在线预览word,excel,pdf,MarkDown(Online Preview Word,Excel,PPT,PDF,Image by Golang)
golang 在线预览word,excel,pdf,MarkDown(Online Preview Word,Excel,PPT,PDF,Image by Golang)

Go View File 在线体验地址 http://39.97.98.75:8082/view/upload (不会经常更新,保留最基本的预览功能。服务器配置较低,如果出现链接超时请等待几秒刷新重试,或者换Chrome) 目前已经完成 docker部署 (不用为运行环境烦恼) Wor

Dec 26, 2022
bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS

bluemonday bluemonday is a HTML sanitizer implemented in Go. It is fast and highly configurable. bluemonday takes untrusted user generated content as

Jan 4, 2023
Elegant Scraper and Crawler Framework for Golang

Colly Lightning Fast and Elegant Scraping Framework for Gophers Colly provides a clean interface to write any kind of crawler/scraper/spider. With Col

Dec 30, 2022
A golang package to work with Decentralized Identifiers (DIDs)

did did is a Go package that provides tools to work with Decentralized Identifiers (DIDs). Install go get github.com/ockam-network/did Example packag

Nov 25, 2022
wcwidth for golang

go-runewidth Provides functions to get fixed width of the character or string. Usage runewidth.StringWidth("つのだ☆HIRO") == 12 Author Yasuhiro Matsumoto

Dec 11, 2022
Parses the Graphviz DOT language in golang

Parses the Graphviz DOT language and creates an interface, in golang, with which to easily create new and manipulate existing graphs which can be writ

Dec 25, 2022
Go (Golang) GNU gettext utilities package

Gotext GNU gettext utilities for Go. Features Implements GNU gettext support in native Go. Complete support for PO files including: Support for multil

Dec 18, 2022
htmlquery is golang XPath package for HTML query.

htmlquery Overview htmlquery is an XPath query package for HTML, lets you extract data or evaluate from HTML documents by an XPath expression. htmlque

Jan 4, 2023
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc.
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc.

omniparser Omniparser is a native Golang ETL parser that ingests input data of various formats (CSV, txt, fixed length/width, XML, EDI/X12/EDIFACT, JS

Jan 4, 2023
Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and struct tags for golang crawler
Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and struct tags for golang crawler

Pagser Pagser inspired by page parser。 Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and str

Dec 13, 2022