markdown/emoji
READMEmodified | Sunday 22 June 2025 |
---|
goldmark-emoji is an extension for the goldmark
that parses :joy:
style emojis.
1go get github.com/yuin/goldmark-emoji
1import (
2 "bytes"
3 "fmt"
4
5 "github.com/yuin/goldmark"
6 "github.com/yuin/goldmark-emoji"
7 "github.com/yuin/goldmark-emoji/definition"
8)
9
10func main() {
11 markdown := goldmark.New(
12 goldmark.WithExtensions(
13 emoji.Emoji,
14 ),
15 )
16 source := `
17 Joy :joy:
18 `
19 var buf bytes.Buffer
20 if err := markdown.Convert([]byte(source), &buf); err != nil {
21 panic(err)
22 }
23 fmt.Print(buf.String())
24}
See emoji_test.go
for detailed usage.
Options for the extension
Option | Description |
---|---|
WithEmojis |
Definition of emojis. This defaults to github emoji set |
WithRenderingMethod |
Entity : renders as HTML entities, Twemoji : renders as an img tag that uses twemoji, Func : renders using a go function |
WithTwemojiTemplate |
Twemoji img tag printf template |
WithRendererFunc |
renders by a go function |
MIT
Yusuke Inuzuka