Skip to content
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 emoji support #1892

Closed
wants to merge 1 commit into from
Closed

Add emoji support #1892

wants to merge 1 commit into from

Conversation

bep
Copy link
Member

@bep bep commented Feb 24, 2016

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 #1891

@bep bep force-pushed the emoji branch 4 times, most recently from 82dbc4d to 31a238d Compare March 2, 2016 19:29
@bep bep changed the title WIP: Add emoji support Add emoji support Mar 2, 2016
@bep bep added the NeedsTriage label Mar 2, 2016
@bep bep added this to the v0.16 milestone Mar 2, 2016
@bep bep force-pushed the emoji branch 6 times, most recently from c0f259e to 3bc3ae2 Compare March 3, 2016 10:26
@bep bep force-pushed the emoji branch 2 times, most recently from e691130 to d3f754e Compare March 10, 2016 09:50

See the [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) for available emoticons.

e.g. `{{ .Title | emojify }}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this example instead?

{{ "I :heart: Hugo" | emojify }}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me like.

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
@bep
Copy link
Member Author

bep commented Mar 11, 2016

@moorereason I have adjusted re your comments. Please merge if you think it looks OK.

@moorereason
Copy link
Contributor

👍 Merged in cafb784.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add emojis support
2 participants