# Enable emoji shortcuts setting should allow escaping with backslashes

**URL:** https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210
**Category:** UX
**Tags:** markdown, pr-welcome
**Created:** [January 25, 2021, 8:01pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210 "2021-01-25T20:01:06Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![incapaz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/incapaz/32/175057_2.png) [@incapaz](https://meta.discourse.org/u/incapaz)
#### Post date: [January 25, 2021, 8:01pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/1 "2021-01-25T20:01:06Z")

</div>

When the `enable emoji shortcuts` setting is enabled emoticons like `:)` get turned into actual emoji (🙂). However, this can’t be bypassed with a simple backslash before it (\:)). This is inconsistent with other things where escape works, and on Discord, you have a similar setting:

![image](https://global.discourse-cdn.com/meta/original/3X/f/d/fdee3e5665b27f85bf42c71387026d861f8dffba.png)

However it is not forced – if I want `:-)` raw I can just type a backslash before it, and I get what I want.

To bypass it you need to use something like a zero-width character in between, or wrap a letter in angle brackets in the middle since those don’t render, etc. i.e.

:\<g\>), :​)

which causes a bad ux for users who want a bit more freedom with how they write emoji.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 29, 2021, 4:17am UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/2 "2021-01-29T04:17:59Z")

</div>

This is not just shortcuts it is all emojis. I guess I am not against changing it so we stop emoji-ing if we have preceding \

So:

```plaintext
\:thinking: has parity with \`thinking` and \*thinking*

```

🤔 has parity with `thinking` and \*thinking\*

---

<div class="post-metadata">

### Author: ![LucasMZReal](https://avatars.discourse-cdn.com/v4/letter/l/bcef8e/32.png) [@LucasMZReal](https://meta.discourse.org/u/LucasMZReal)
#### Post date: [January 31, 2021, 2:02am UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/4 "2021-01-31T02:02:29Z")

</div>

I made a post about this on the roblox dev-forum which uses discourse, and I agree, having to always use empty characters, or anything to NOT use an emoji is kind of annoying; Emojis usually make your post a bit more unprofessional, and sometimes you want a little :) but you don’t want a 🙂

I hope this gets changed, (“I guess it woudn’t update since it’s open-source and everything;”)

---

<div class="post-metadata">

### Author: ![Shark.93](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shark.93/32/208319_2.png) [@Shark.93](https://meta.discourse.org/u/Shark.93)
#### Post date: [February 4, 2021, 12:26am UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/5 "2021-02-04T00:26:59Z")

</div>

Actually I found this topic because I just stumbled into this inquiry myself (tried to escape a smiley but alas, it turned into an emoji AND swallowed my escape character … the audacity, ahah)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 7, 2021, 9:13pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/6 "2021-03-07T21:13:11Z")

</div>

We have an existing bypass for this in backtick, e.g. `:-)` and `:)` .. plus code blocks .. not really sure we need even more methods to achieve the same goal?

---

<div class="post-metadata">

### Author: ![incapaz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/incapaz/32/175057_2.png) [@incapaz](https://meta.discourse.org/u/incapaz)
#### Post date: [March 7, 2021, 10:47pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/7 "2021-03-07T22:47:19Z")

</div>

My point was more of using emoji in actual conversation, and wouldn’t it just be a matter of not rendering the emoji, keeping it as an emoticon if there is a backslash before it ?

`` are for inline code, if you’re not having a programming discussion using code blocks doesn’t make sense. Even if it was it still doesn’t make sense as inline codes are generally used for highlighting a single line of code or for highlighting class/member names and such.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 7, 2021, 11:01pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/8 "2021-03-07T23:01:08Z")

</div>

Not so – HTML will try to render if you type `<a>` for example. So inline code blocks are the expected way to render that.

Just not sure I want to spend valuable engineering time on something that we already have a way of handling.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 8, 2021, 1:58am UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/9 "2021-03-08T01:58:11Z")

</div>

I am putting PR welcome on this, had a 15 minute look at this and there is no trivial fix.

Our parser eats the escape code so by the time we have it we have no idea the escape was there.

Whatever fix exists here it will involve hacking markdown.it and upstreaming a patch. Very very complicated … cc @Vitaly

Same issue at [https://markdown-it.github.io/](https://markdown-it.github.io/)

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/5/25f911f24183576d20def975042818de6724f633.png)

Recommend you open a ticket upstream, though this may mean we need to annotate text tokens with “original raw for the text token”.

Difficulty level on this is about 95.

---

<div class="post-metadata">

### Author: ![Vitaly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vitaly/32/120475_2.png) [@Vitaly](https://meta.discourse.org/u/Vitaly)
#### Post date: [January 7, 2022, 8:58am UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/10 "2022-01-07T08:58:48Z")

</div>

This bug has the similar design miss as “underscores can break autolinks”, but may be specific kludge possible. I will take a look what can be done.

Created issue: [Postpone escape info drop · Issue #840 · markdown-it/markdown-it · GitHub](https://github.com/markdown-it/markdown-it/issues/840)

---

<div class="post-metadata">

### Author: ![mcmuffin6o](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mcmuffin6o](https://meta.discourse.org/u/mcmuffin6o)
#### Post date: [August 21, 2022, 7:58pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/11 "2022-08-21T19:58:00Z")

</div>

I must wholeheartedly disagree. “`:)`” is simply not the same as “:)”.

Still, I do agree that this is not something to waste time/money on. Annoying, but understandable.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 21, 2022, 9:13pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/12 "2022-08-21T21:13:58Z")

</div>

Looks like @Vitaly fixed in v13, we will upgrade to it

---

<div class="post-metadata">

### Author: ![Rhababo](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@Rhababo](https://meta.discourse.org/u/Rhababo)
#### Post date: [September 14, 2023, 5:29pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/13 "2023-09-14T17:29:23Z")

</div>

A user in my forum complained about this formatting issue, I’ve disabled emoji autocomplete as the fix for our use case, but since discourse upgraded to markdown-it v13 a while back the issue seemed to persist whereas backslash-escape now works on [https://markdown-it.github.io/](https://markdown-it.github.io/)

Could this be because ember.js is still relying on markdown v12 as indicated here?

> [@Multisite build error: #\<MiniRacer::RuntimeError: Error: Parser rule not found: fragments\_join\>](https://meta.discourse.org/t/multisite-build-error-miniracer-error-parser-rule-not-found-fragments-join/239265/6):
>
> Hmm interesting, let’s see: play_button `yarn why` So discourse’s package.json is requesting 13.0.1, ember-cli’s own package.json [requests 12.0.4](https://github.com/ember-cli/ember-cli/blob/53b5dcc903abc96a3d66f16804fa56b85e32c101/package.json#L104-L105), and markdown-it-terminal [requires 8.4.2](https://github.com/trabus/markdown-it-terminal/blob/3afe70d8a0d565e3107e0a96b5a728876589dbb7/package.json#L35). Anyway, in theory this should all be invisible. Discourse itself is asking for 13.0.1, and so the version in app/assets/javascripts/node\_modules/markdown-it should be 13.0.1. The other older versions will be made available to their respective parents. Given that we’re not seeing this internally, and this is only happe…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 1, 2024, 11:22pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/14 "2024-01-01T23:22:38Z")

</div>

We are on 13 now afaik… cc @david and issue remains.

> <https://github.com/discourse/discourse/blob/7f50ead4bb35ed70f6b21a0a3789c564e29fd3fd/app/assets/javascripts/discourse-markdown-it/package.json#L24-L24>

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [January 2, 2024, 10:43am UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/15 "2024-01-02T10:43:37Z")

</div>

Looks like we have our own Emoji implementation - we don’t use the markdown-it one.

(shortcuts defined [here](https://github.com/discourse/discourse/blob/655c10610173991ae8ec8b74abf2697630f081f2/app/assets/javascripts/pretty-text/addon/emoji/data.js#L6336-L6345), referenced [here](https://github.com/discourse/discourse/blob/655c10610173991ae8ec8b74abf2697630f081f2/app/assets/javascripts/pretty-text/addon/emoji.js#L70-L75). Replacement logic is [here](https://github.com/discourse/discourse/blob/655c10610173991ae8ec8b74abf2697630f081f2/app/assets/javascripts/pretty-text/addon/emoji.js#L51-L55))

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [January 2, 2024, 8:50pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/16 "2024-01-02T20:50:02Z")

</div>

Oh so this should be rather straightforward to fix (famous last words)

---

<div class="post-metadata">

### Author: ![SKB](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/skb/32/367287_2.png) [@SKB](https://meta.discourse.org/u/SKB)
#### Post date: [March 1, 2024, 6:41pm UTC](https://meta.discourse.org/t/enable-emoji-shortcuts-setting-should-allow-escaping-with-backslashes/177210/17 "2024-03-01T18:41:40Z")

</div>

I’m beginning work on this now. 🙂

Edit: This may be harder than I thought. 🙃
