Skip to content

mcdee/go-markdown-emoji

Repository files navigation

go-markdown-emoji

Tag License Travis CI codecov.io

Go module to add emoji support to go-markdown.

Table of Contents

Install

go-markdown-emoji is a standard Go module which can be installed with:

go get github.com/mcdee/go-markdown-emoji

Usage

go-markdown-emoji provides parser and renderer hooks to the markdown engine. The parser hook is Parser and the renderer Renderer.

Emojis are signified in Markdown as names between colons, for example :smile:. A full list of the emojis supported can be seen in emoji.go.

Example

package main

import (
    "github.com/gomarkdown/markdown"
    "github.com/gomarkdown/markdown/html"
    "github.com/gomarkdown/markdown/parser"
    emoji "github.com/mcdee/go-markdown-emoji"
)

func main() {
    p := parser.New()
    p.Opts = parser.Options{ParserHook: emoji.Parser}
    r := html.NewRenderer(html.RendererOptions{
      Flags: html.CommonFlags,
      RenderNodeHook: emoji.Renderer,
    })

    html := markdown.ToHTML([]byte(":smile:"), p, r)
    fmt.Printf("%s\n", string(html))
}

Maintainers

Jim McDonald: @mcdee.

Contribute

Contributions welcome. Please check out the issues.

License

Apache-2.0.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published