MarkdownEmojiMapping Class

The shortcodes, such as :smile:, and the smileys, such as :), that MarkdownExtensions.Emoji reads, and their emoji.

public sealed class MarkdownEmojiMapping

Constructors

NameDescription
MarkdownEmojiMapping(IReadOnlyDictionary<string, string>, IReadOnlyDictionary<string, string>)Creates a mapping from shortcodes to emoji, and from smileys to shortcodes.

MarkdownEmojiMapping(IReadOnlyDictionary<string, string>, IReadOnlyDictionary<string, string>)

MarkdownEmojiMapping.cs

Creates a mapping from shortcodes to emoji, and from smileys to shortcodes.

public MarkdownEmojiMapping(IReadOnlyDictionary<string, string> shortcodes, IReadOnlyDictionary<string, string> smileys)

Parameters

shortcodes IReadOnlyDictionary<string, string>
The emoji of the shortcodes, such as :smile:.
smileys IReadOnlyDictionary<string, string>
The shortcode of the smileys, such as :), which must be a shortcode of shortcodes.

Exceptions

ArgumentNullException
shortcodes or smileys is null.
ArgumentException
A key or a value is empty, a key contains a line ending, a smiley is not for a shortcode, or a smiley is a shortcode.

Properties

NameDescription
DefaultGets the shortcodes of GitHub and the arrows, and the common smileys, such as :), ;) and <3.
DefaultWithoutSmileysGets the shortcodes of GitHub and the arrows, without smileys.
ShortcodesGets the emoji of the shortcodes, such as :smile:.
SmileysGets the shortcode of the smileys, such as :): each one is a key of MarkdownEmojiMapping.Shortcodes.

Gets the shortcodes of GitHub and the arrows, and the common smileys, such as :), ;) and <3.

public static MarkdownEmojiMapping Default { get; }

Property value

MarkdownEmojiMapping

DefaultWithoutSmileys

MarkdownEmojiMapping.cs

Gets the shortcodes of GitHub and the arrows, without smileys.

public static MarkdownEmojiMapping DefaultWithoutSmileys { get; }

Property value

MarkdownEmojiMapping

Gets the emoji of the shortcodes, such as :smile:.

public IReadOnlyDictionary<string, string> Shortcodes { get; }

Property value

IReadOnlyDictionary<string, string>

Remarks

Use it with MarkdownEmojiMapping.Smileys to make a mapping from another one, such as MarkdownEmojiMapping.Default with fewer smileys.

Gets the shortcode of the smileys, such as :): each one is a key of MarkdownEmojiMapping.Shortcodes.

public IReadOnlyDictionary<string, string> Smileys { get; }

Methods

NameDescription
TryGetEmoji(string, string?)Gets the emoji of a shortcode or of a smiley.

TryGetEmoji(string, string?)

MarkdownEmojiMapping.cs

Gets the emoji of a shortcode or of a smiley.

public bool TryGetEmoji(string text, out string? emoji)

Parameters

text string
emoji string?

Returns

bool

Exceptions

ArgumentNullException
text is null.