emoji

package module
v2.0.0-...-60f4a08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var DefaultEmojis def.Emojis

Functions

func NewEmojiHTMLRenderer

func NewEmojiHTMLRenderer() renderer.NodeRenderer

func NewEmojiParser

func NewEmojiParser(emojis def.Emojis) parser.InlineParser

func NewExtender

func NewExtender(elems ...def.Emojis) goldmark.Extender
Example
package main

import (
	"bytes"
	"fmt"

	emoji "github.com/CarsonSlovoka/goldmark-emoji/v2"
	"github.com/CarsonSlovoka/goldmark-emoji/v2/def"
	"github.com/yuin/goldmark"
	"os"
)

func main() {
	markdown := goldmark.New(
		goldmark.WithExtensions(
			emoji.NewExtender(def.Github(), def.TW()),
		),
	)

	if err := markdown.Convert([]byte(":blush:"), os.Stdout); err != nil {
		panic(err)
	}

	out := bytes.NewBuffer(make([]byte, 0))
	content := []byte(`Hello World. :blush: :臉紅:`)
	if err := markdown.Convert(content, out); err != nil {
		panic(err)
	}
	fmt.Println(out)
}
Output:

<p>😊</p>
<p>Hello World. 😊 😊</p>

Types

type ParserConfig

type ParserConfig struct {
	Emojis def.Emojis
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL