File: README.md

package info (click to toggle)
golang-github-yuin-goldmark-emoji 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 232 kB
  • sloc: makefile: 2
file content (71 lines) | stat: -rw-r--r-- 1,496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
goldmark-emoji
=========================

[![GoDev][godev-image]][godev-url]

[godev-image]: https://pkg.go.dev/badge/github.com/yuin/goldmark-emoji
[godev-url]: https://pkg.go.dev/github.com/yuin/goldmark-emoji

goldmark-emoji is an extension for the [goldmark](http://github.com/yuin/goldmark) 
that parses `:joy:` style emojis.

Installation
--------------------

```
go get github.com/yuin/goldmark-emoji
```

Usage
--------------------

```go
import (
    "bytes"
    "fmt"

    "github.com/yuin/goldmark"
    "github.com/yuin/goldmark-emoji"
    "github.com/yuin/goldmark-emoji/definition"
)

func main() {
    markdown := goldmark.New(
        goldmark.WithExtensions(
            emoji.Emoji,
        ),
    )
    source := `
    Joy :joy:
    `
    var buf bytes.Buffer
    if err := markdown.Convert([]byte(source), &buf); err != nil {
        panic(err)
    }
    fmt.Print(buf.String())
}
```

See `emoji_test.go` for detailed usage.

### Options

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](https://github.com/twitter/twemoji), `Func` : renders using a go function |
| `WithTwemojiTemplate` | Twemoji img tag printf template |
| `WithRendererFunc` | renders by a go function |



License
--------------------
MIT

Author
--------------------
Yusuke Inuzuka