no-emoji
โญ CommonMark
๐ GFM
๐ Rule Source
๐ Test Source
Disallow emojis in text.
Rule Details โ
Some websites and Markdown parsers handle emojis natively or provide their own plugins for support. Instead of using raw emojis like ๐, you can use the :smiley:-style shortcode syntax, which places colons around the emoji name.
The main purpose of this rule is to discourage the use of raw (Unicode) emojis in Markdown files and encourage the use of the :smiley:-style shortcode syntax for better:
- Cross-platform rendering consistency
- Accessibility (screen readers can receive clearer text equivalents)
- Diff readability (pure text instead of glyphs)
- Theming or post-processing (shortcodes are easier to map or replace)
For a full list of supported emojis, refer to:
Platforms like GitHub and Markdown plugins such as remark-emoji and markdown-it-emoji also support this shortcode feature.
Examples โ
โ Incorrect โ
Examples of incorrect code for this rule:
<!-- eslint md/no-emoji: 'error' -->
Smiley ๐
Unicorn ๐ฆ
+1 ๐โ Correct โ
Examples of correct code for this rule:
<!-- eslint md/no-emoji: 'error' -->
Smiley :smiley:
Unicorn :unicorn:
+1 :+1:With { allow: ['๐', '๐ฆ'] } Option โ
<!-- eslint md/no-emoji: ['error', { allow: ['๐', '๐ฆ'] }] -->
Smiley ๐
Unicorn ๐ฆ
+1 :+1:Options โ
'md/no-emoji': ['error', {
allow: [],
}]allow โ
Type:
string[]/ Default:[]
When specified, specific emoji sequences are allowed if they match one of the strings in this array. This is useful when a document intentionally uses a small set of raw Unicode emojis while still disallowing all others.
Limitations โ
This rule uses /\p{RGI_Emoji}/gv internally to match emojis. Unicode property escapes rely on the Unicode data/version supported by the runtime, so matches can vary across environments. Also, RGI_Emoji targets only Unicode's "Recommended for General Interchange" emoji set, so it may not match some non-RGI or emoji-like sequences.