-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add emojis support #1891
Comments
kyokomi/emoji seems to be a lightweight Go implementation for printing emojis. |
Thanks, @digitalcraftsman - I have tested that one in Hugo (see PR in progress) and it only partially works in my tests ... And it is not very efficient the way it is done now, but that can be fixed ... Will have a look at it ... later. |
Maybe this is better to do directly with the content files. |
OK, I found the issue now ... that emoji gets confused if you have colon ( : ) in your text ... |
That was a fast bugfix. I think it would also make sense to add a template function, something like |
Another issue in that library: kyokomi/emoji#6 It doesn't matter too much for us as I'm rewriting the replacement part of it to fit Hugo, but I use that library as a facit in my tests. |
This uses the Emoji map from https://github.com/kyokomi/emoji -- but with a custom replacement implementation. The built-in are fine for most use cases, but in Hugo we do care about pure speed. The benchmarks below are skewed in Hugo's direction as the source and result is a byte slice, Kyokomi's implementation works best with strings. Curious: The easy-to-use `strings.Replacer` is also plenty fast. ``` BenchmarkEmojiKyokomiFprint-4 20000 86038 ns/op 33960 B/op 117 allocs/op BenchmarkEmojiKyokomiSprint-4 20000 83252 ns/op 38232 B/op 122 allocs/op BenchmarkEmojiStringsReplacer-4 100000 21092 ns/op 17248 B/op 25 allocs/op BenchmarkHugoEmoji-4 500000 5728 ns/op 624 B/op 13 allocs/op ``` Fixes gohugoio#1891
Thanks! |
@bep do I need enable something for templating functions? Looks like templating doesn't work for me. I have Hugo Static Site Generator v0.16-DEV BuildDate: 2016-03-13T08:10:03+01:00 |
@yangwao please use http://discuss.gohugo.io/ for questions. |
This uses the Emoji map from https://github.com/kyokomi/emoji -- but with a custom replacement implementation. The built-in are fine for most use cases, but in Hugo we do care about pure speed. The benchmarks below are skewed in Hugo's direction as the source and result is a byte slice, Kyokomi's implementation works best with strings. Curious: The easy-to-use `strings.Replacer` is also plenty fast. ``` BenchmarkEmojiKyokomiFprint-4 20000 86038 ns/op 33960 B/op 117 allocs/op BenchmarkEmojiKyokomiSprint-4 20000 83252 ns/op 38232 B/op 122 allocs/op BenchmarkEmojiStringsReplacer-4 100000 21092 ns/op 17248 B/op 25 allocs/op BenchmarkHugoEmoji-4 500000 5728 ns/op 624 B/op 13 allocs/op ``` Fixes gohugoio#1891
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
See the update task here for inspiration for a
go generate
task:https://github.com/Ranks/emojify.js/blob/master/gulpfile.js
The images´ license looks complicated:
https://github.com/arvida/emoji-cheat-sheet.com/blob/master/LICENSE
Not sure if there are any options here.
It could hook nicely into the transformer chain, maybe. Not sure how be should bundle the images.
Should have a flag, default off.
The text was updated successfully, but these errors were encountered: