Go · 5568 bytes Raw Blame History
1 // SPDX-License-Identifier: AGPL-3.0-or-later
2
3 package extensions
4
5 // emojiMap is a small curated set of emoji shortcodes mapped to
6 // their unicode rune sequences. Sourced from the gemoji project's
7 // stable subset; we deliberately avoid trending/political shortcodes.
8 //
9 // Adding a shortcode: append below + bump `markdown.Version`. Bytes
10 // are direct UTF-8 (no escape sequences) so the file's bytes are
11 // the rendered output.
12 var emojiMap = map[string]string{
13 // Common reactions
14 "+1": "👍",
15 "-1": "👎",
16 "thumbsup": "👍",
17 "thumbsdown": "👎",
18 "smile": "😄",
19 "laughing": "😆",
20 "joy": "😂",
21 "heart": "❤️",
22 "heart_eyes": "😍",
23 "tada": "🎉",
24 "rocket": "🚀",
25 "fire": "🔥",
26 "sparkles": "✨",
27 "eyes": "👀",
28 "thinking": "🤔",
29 "thinking_face": "🤔",
30 "wave": "👋",
31 "clap": "👏",
32 "pray": "🙏",
33 "100": "💯",
34 "check": "✅",
35 "x": "❌",
36 "warning": "⚠️",
37 "bug": "🐛",
38 "sparkle": "✨",
39 "star": "⭐",
40 "hammer": "🔨",
41 "wrench": "🔧",
42 "package": "📦",
43 "books": "📚",
44 "book": "📖",
45 "memo": "📝",
46 "pencil": "✏️",
47 "shipit": "🚢",
48 "ship": "🚢",
49 "lock": "🔒",
50 "unlock": "🔓",
51 "key": "🔑",
52 "link": "🔗",
53 "speech_balloon": "💬",
54 "thought_balloon": "💭",
55 "computer": "💻",
56 "keyboard": "⌨️",
57 "floppy_disk": "💾",
58 "cd": "💿",
59 "dvd": "📀",
60 "clipboard": "📋",
61 "chart": "📈",
62 "bar_chart": "📊",
63 "calendar": "📅",
64 "date": "📆",
65 "hourglass": "⌛",
66 "alarm_clock": "⏰",
67 "clock1": "🕐",
68 "bell": "🔔",
69 "no_bell": "🔕",
70 "loudspeaker": "📢",
71 "mega": "📣",
72 "mailbox": "📫",
73 "envelope": "✉️",
74 "postbox": "📮",
75 "package_2": "📮",
76 "mag": "🔍",
77 "telescope": "🔭",
78 "microscope": "🔬",
79 "hammer_and_wrench": "🛠️",
80 "gear": "⚙️",
81 "toolbox": "🧰",
82 "nut_and_bolt": "🔩",
83 "satellite": "📡",
84 "globe": "🌍",
85 "earth_americas": "🌎",
86 "earth_asia": "🌏",
87 "new": "🆕",
88 "free": "🆓",
89 "abc": "🔤",
90 "abcd": "🔡",
91 "capital_abcd": "🔠",
92 "information_source": "ℹ️",
93 "interrobang": "⁉️",
94 "question": "❓",
95 "grey_question": "❔",
96 "exclamation": "❗",
97 "grey_exclamation": "❕",
98 "o": "⭕",
99 "x_circle": "❌",
100 "white_check_mark": "✅",
101 "ballot_box_with_check": "☑️",
102 "heavy_check_mark": "✔️",
103 "heavy_multiplication_x": "✖️",
104 "heavy_plus_sign": "➕",
105 "heavy_minus_sign": "➖",
106 "heavy_division_sign": "➗",
107 "recycle": "♻️",
108 "infinity": "♾️",
109 "trophy": "🏆",
110 "medal": "🏅",
111 "first_place": "🥇",
112 "second_place": "🥈",
113 "third_place": "🥉",
114 "crown": "👑",
115 "gem": "💎",
116 "art": "🎨",
117 "musical_note": "🎵",
118 "musical_score": "🎼",
119 "sound": "🔊",
120 "mute": "🔇",
121 "video_camera": "📹",
122 "camera": "📷",
123 "camera_flash": "📸",
124 "film_strip": "🎞️",
125 "clapper": "🎬",
126 "microphone": "🎤",
127 "headphones": "🎧",
128 "radio": "📻",
129 "tv": "📺",
130 "phone": "📞",
131 "telephone": "☎️",
132 "iphone": "📱",
133 "calling": "📲",
134 "battery": "🔋",
135 "electric_plug": "🔌",
136 "bulb": "💡",
137 "flashlight": "🔦",
138 "candle": "🕯️",
139 "sun": "☀️",
140 "sunny": "☀️",
141 "moon": "🌙",
142 "star_2": "🌟",
143 "stars": "🌠",
144 "cloud": "☁️",
145 "snowflake": "❄️",
146 "zap": "⚡",
147 "umbrella": "☂️",
148 "rainbow": "🌈",
149 "droplet": "💧",
150 "ocean": "🌊",
151 "snowman": "☃️",
152 "comet": "☄️",
153 "v": "✌️",
154 "point_up": "☝️",
155 "point_down": "👇",
156 "point_left": "👈",
157 "point_right": "👉",
158 "raised_hand": "✋",
159 "open_hands": "👐",
160 "muscle": "💪",
161 "writing_hand": "✍️",
162 "selfie": "🤳",
163 "facepunch": "👊",
164 "fist": "✊",
165 "poo": "💩",
166 "hankey": "💩",
167 "shit": "💩",
168 }
169
170 // lookupEmoji returns the unicode replacement for a shortcode,
171 // or ("", false) if the code isn't in our curated set.
172 func lookupEmoji(name string) (string, bool) {
173 v, ok := emojiMap[name]
174 return v, ok
175 }
176