:smile:) into actual emoji characters (😄) both in the editor and in preview mode.
Overview
Type emoji shortcodes and see them rendered as emoji: Input::smile: :heart: :rocket:
Output: 😄 ❤️ 🚀
The plugin works in two contexts:
- Editor (Live): Replaces
:codes:with emoji while editing - Preview/Reader: Converts
:codes:to emoji in rendered markdown
packages/plugins/src/emoji/EmojiPlugin.ts:1-10
Features
GitHub Emoji Support
Supports all GitHub emoji shortcodes:- Smileys:
:smile:😄,:laughing:😆,:blush:😊 - Hearts:
:heart:❤️,:blue_heart:💙,:purple_heart:💜 - Hands:
:thumbsup:👍,:clap:👏,:raised_hands:🙌 - Objects:
:rocket:🚀,:book:📖,:bulb:💡 - Nature:
:sunny:☀️,:star:⭐,:fire:🔥 - And 1,800+ more
packages/plugins/src/emoji/emojiMap.ts (complete emoji database)
Selection-Aware Rendering
Emoji rendering is cursor-aware::code: so you can edit it. When the cursor moves away, it renders as emoji.
Source: packages/plugins/src/emoji/EmojiPlugin.ts:95-107
Viewport Optimization
Only visible emoji are processed:packages/plugins/src/emoji/emojiExtension.ts:47-50
Implementation
Dual-Context Architecture
The plugin implements emoji conversion in both contexts:packages/plugins/src/emoji/EmojiPlugin.ts:37-65
Emoji Widget
Emoji are rendered using CodeMirror widgets:- Renders emoji as plain text content
- Non-editable (cursor: default)
- Lightweight DOM element
- Equality check for efficient updates
packages/plugins/src/emoji/EmojiPlugin.ts:16-32
Emoji Regex
Emoji codes are matched with a pre-compiled regex::- Opening colon (literal)([a-z0-9_+-]+)- Capture group: lowercase letters, numbers, underscore, plus, hyphen:- Closing colon (literal)gi- Global, case-insensitive
- Matches:
:smile:,:blue_heart:,:+1: - Doesn’t match:
:SMILE:(uppercase),smile:(no opening),:smile(no closing)
packages/plugins/src/emoji/EmojiPlugin.ts:11
Emoji Map
The emoji database maps shortcodes to Unicode characters:packages/plugins/src/emoji/emojiMap.ts
Usage Examples
Common Emoji
Reactions
👍 👍 Agree 👎 👎 Disagree ❤️ Love it 🔥 Hot take 👏 Well doneStatus
✅ Complete ❌ Incomplete ⚠️ Warning ℹ️ InfoObjects
🚀 Launch 📖 Documentation 💡 Idea 🔧 Fix ✨ FeatureCommit Messages
Task Lists
Notes and Highlights
Emoji Categories
Smileys & People
Animals & Nature
Food & Drink
Activities & Sports
Travel & Places
Objects
Symbols
Finding Emoji Codes
Emoji Cheat Sheet
Use the Emoji Cheat Sheet to find shortcodes.Common Patterns
Many emoji follow patterns:- Skin tones:
:wave:+_tone1-5=:wave_tone1: - Flags:
:flag_+ country code =:flag_us: - Variations:
:heart:,:blue_heart:,:purple_heart:
Searching
Most emoji have intuitive names:- Think of the object: “rocket” →
:rocket: - Think of the action: “running” →
:running: - Think of the symbol: “check mark” →
:white_check_mark:
Performance
Regex Performance
The emoji regex is pre-compiled and very fast:- Compilation: Once at plugin load
- Matching: O(n) where n = text length
- Per emoji: < 0.01ms
Widget Performance
Emoji widgets are lightweight:- DOM element: Single
<span> - Memory: ~100 bytes per emoji
- Rendering: Instant (native text)
Viewport Optimization
Only visible emoji are processed:- Large document (1000 emoji): Only ~50 in viewport
- Processing time: < 5ms per scroll
- Memory impact: Minimal
Installation
The Emoji plugin is built-in and enabled by default. To toggle it:- Open Settings → Plugins
- Find “Emoji”
- Toggle the enable switch
Configuration
The Emoji plugin currently has no user-configurable settings.Potential Future Settings
- Emoji style: Native, Twitter, Apple, Google
- Skin tone preference: Default skin tone for people emoji
- Custom emoji: Add custom shortcodes
- Disable in code: Don’t convert emoji in code blocks
Standalone Extension
The emoji extension can be used without the plugin system:packages/plugins/src/emoji/emojiExtension.ts:95-111
Troubleshooting
Emoji not converting
Solutions:- Check the plugin is enabled
- Verify you’re using the correct shortcode (lowercase, underscores)
- Check that emoji exists in GitHub emoji set
- Try restarting Inkdown
Wrong emoji appears
Cause: Shortcode ambiguity or typo. Solution: Use the Emoji Cheat Sheet to verify the correct shortcode.Emoji reverts to :code:
Cause: Cursor is near the emoji. Behavior: This is intentional - emoji shows as:code: when editing.
Solution: Move cursor away to see rendered emoji.
Emoji in code blocks
Issue: Don’t want emoji in code blocks. Current behavior: Emoji converts everywhere, including code blocks. Workaround: Use backticks within code:\:smile\:
Performance issues
Symptom: Slow editor with many emoji. Solutions:- Emoji plugin already uses viewport optimization
- Check other plugins aren’t causing slowness
- Try disabling emoji plugin temporarily to confirm
API Reference
Plugin Class
packages/plugins/src/emoji/EmojiPlugin.ts:37-70
Emoji Extension
Extension that applies emoji decorations
Source: packages/plugins/src/emoji/emojiExtension.ts:95-111
Emoji Widget
Emoji Map
packages/plugins/src/emoji/emojiMap.ts
Integration with Other Plugins
Live Preview
Emoji plugin works seamlessly with Live Preview:- Both use decorations
- No conflicts
- Emoji rendered in formatted markdown
Export/Publishing
Emoji convert during export:- HTML export: Unicode emoji characters
- PDF export: Rendered emoji (if font supports)
- Markdown export: Keeps
:shortcodes:
Accessibility
Screen Readers
Emoji are announced by screen readers:- Native emoji have built-in descriptions
- “Smiling face with open mouth” for 😄
- “Red heart” for ❤️
Keyboard Navigation
Emoji don’t interfere with keyboard navigation:- Tab skips over emoji
- Arrow keys treat emoji as single character
- Delete removes entire emoji
High Contrast
Emoji visibility in high contrast mode:- Native emoji respect OS contrast settings
- Text-based fallback if emoji fail to render
Unicode Considerations
Encoding
All emoji are UTF-8 encoded:- Compatible with all modern systems
- Safe for file storage
- Network transmission compatible
Font Support
Emoji rendering depends on system fonts:- macOS: Apple Color Emoji
- Windows: Segoe UI Emoji
- Linux: Noto Color Emoji (if installed)
Fallback
If emoji font is missing:- System may show tofu (□)
- Or black & white glyph
- Consider using
:shortcode:instead
See Also
Live Preview
Real-time markdown rendering
Emoji Cheat Sheet
Complete emoji reference
CodeMirror Extensions
Creating editor extensions
Plugin Development
Build custom plugins
