def

package
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: 0 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emoji

type Emoji struct {
	Desc    string
	Unicode []rune   // 該emoji可能是有很多個codepoints組合而成,例如: red_haired_man: {👨 U+1F468, ‍ U+200D, 🦰 U+1F9B0} 是由這三者組合而成: https://apps.timwhitlock.info/unicode/inspect?s=%F0%9F%91%A8%E2%80%8D%F0%9F%A6%B0
	Aliases []string // 允許有很多別名
}

func NewEmoji

func NewEmoji(desc string, unicode []rune, alias ...string) Emoji

func (*Emoji) String

func (e *Emoji) String() string

type Emojis

type Emojis interface {
	Get(alias string) (*Emoji, bool)
	Add(*Emojis)
}

func Github

func Github() Emojis

func NewEmojis

func NewEmojis(es ...Emoji) Emojis
Example
package main

import (
	"fmt"
	"github.com/CarsonSlovoka/goldmark-emoji/v2/def"
)

func main() {
	es := def.NewEmojis(
		def.NewEmoji("man: red hair", []rune{0x1F468, 0x200D, 0x1F9B0}, "red_haired_man", "man_red_hair"),
		def.NewEmoji("😊", []rune{0x1F60A}, "blush", "smiling_face_with_smiling_eyes", "微笑"),
	)
	e, _ := es.Get("man_red_hair")
	fmt.Println(e.Desc)
	fmt.Printf("%s\n", string(e.Unicode))
	fmt.Println(e.Aliases[0])
}
Output:

man: red hair
👨‍🦰
red_haired_man

func TW

func TW() Emojis

Jump to

Keyboard shortcuts

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