jesseduffield.lazygit/vendor/github.com/yuin/goldmark-emoji
Jesse Duffield 3a191b913f Add release notes popup after update
We're using glamour for rendering the markdown, and I'm interested in using it in other places
too
2024-01-13 19:26:26 +11:00
..
ast Add release notes popup after update 2024-01-13 19:26:26 +11:00
definition Add release notes popup after update 2024-01-13 19:26:26 +11:00
.gitignore Add release notes popup after update 2024-01-13 19:26:26 +11:00
emoji.go Add release notes popup after update 2024-01-13 19:26:26 +11:00
LICENSE Add release notes popup after update 2024-01-13 19:26:26 +11:00
README.md Add release notes popup after update 2024-01-13 19:26:26 +11:00

goldmark-emoji

GoDev

goldmark-emoji is an extension for the goldmark that parses :joy: style emojis.

Installation

go get github.com/yuin/goldmark-emoji

Usage

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, Func : renders using a go function
WithTwemojiTemplate Twemoji img tag printf template
WithRendererFunc renders by a go function

License

MIT

Author

Yusuke Inuzuka