Skip to content

An emoji extension for the goldmark markdown parser

License

Notifications You must be signed in to change notification settings

yuin/goldmark-emoji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

An emoji extension for the goldmark markdown parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages