emoji

package
v0.0.0-...-941e8e5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package emoji handles Unicode emoji.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replace

func Replace(nodes ...*html.Node) []*html.Node

Replace finds Unicode emoji and emoji shortcodes (such as :tophat:) and replaces them with Unicode emoji with tooltips. Replace is idempotent.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is a custom emoji set that extends the default set.

func (*Config) AddEmoji

func (conf *Config) AddEmoji(unicodeEmoji, description string, aliases []string, category string, tags []string)

AddEmoji adds a custom Unicode emoji to the Config.

func (*Config) AddImage

func (conf *Config) AddImage(imageURL, description string, aliases []string, category string, tags []string)

AddImage adds an image as a pseudo-emoji. At least one alias is required.

func (*Config) Replace

func (conf *Config) Replace(nodes ...*html.Node) []*html.Node

Replace finds Unicode emoji and emoji shortcodes (such as :tophat:) and replaces them with Unicode emoji with tooltips. Replace is idempotent.

func (*Config) Search

func (conf *Config) Search(query string, max int) []SearchResult

Search returns a list of possible emoji for a query. The query is the text between the colon (:) and the user's cursor.

type SearchResult

type SearchResult struct {
	// contains filtered or unexported fields
}

SearchResult is a result from the Search function.

Either Emoji or ImageURL will return a non-empty string, but not both.

func Search(query string, max int) []SearchResult

Search returns a list of possible emoji for a query. The query is the text between the colon (:) and the user's cursor.

func (SearchResult) Aliases

func (s SearchResult) Aliases() []string

Aliases is a slice of textual shortcodes that can be used between colons to represent the emoji.

func (SearchResult) Description

func (s SearchResult) Description() string

Description is the English textual description of the emoji.

func (SearchResult) Emoji

func (s SearchResult) Emoji() string

Emoji is the Unicode emoji.

func (SearchResult) ImageURL

func (s SearchResult) ImageURL() string

ImageURL is the URL of an image representing this emoji.

func (SearchResult) Score

func (s SearchResult) Score() int

Score is the likelihood of the result being correct. Higher is better.

Jump to

Keyboard shortcuts

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