Slack uses various characters for its own markdown formatting.
How can I enter a message with those reserved characters escaped?
e.g. Is it possible to send a message exactly like this:
*I don't want this to be bold*
Web Applications Stack Exchange is a question and answer site for power users of web applications. It only takes a minute to sign up.Sign up to join this community
Copy and paste the text below and change the word in the asterisks for your own needs:
It will not be rendered as bold text when you post your Slack message. Note: There are hidden characters either side of the asterisks which will prevent Slack from formatting your word(s) between the asterisks.
This is a variation of ShaneB's answer that seems to work better. Instead of adding (invisible) space to the asterisk's "attached" side:
There is *|no|* spoon // '|' = vertical tab
consider removing space on the "detached" side by inserting (invisible) non-space:
There is |*no*| spoon // '|' = e.g. soft hyphen (­, U+00AD)
This "embeds" the asterisk and thus renders it inactive. Soft hyphen seems like a good character here.
I just tested and a single back-tick will escape upcoming formatting characters for the rest of the message.
`*I don't want this to be bold*`
That will be formatted as code
`*I don't want this to be bold*
That will be formatted normally but both asterisks will appear instead of making the text bold.
It seems Google has updated the Chrome web browser controls (and possibly others) to show placeholders for many common ASCII control characters, INCLUDING the Vertical Tab character! This change has caused my original Solution below to break, now showing "unknown character" squares or in some cases whitespace breaks, where before it was non-breaking in most use cases (notably Slack!). Not to fear, there is a simple Fix!
FIX: Instead of using a Vertical Tab (hex character 0x0B), NOW use a Form Feed character (hex character 0x0C)!
Solution: Copy the below fixed text to Slack and Edit:
There is once again *no* spoon
Or use any hex to ascii converter (ie: ASCII to Hex) to convert this:
2a 0c 68 61 78 0c 2a
Personally I find it's always easiest and more compatible to use an ASCII range solution as opposed to tempting fate with a Unicode solution like in leclercdumombasin's answer. HOWEVER, as far as usability is concerned leclercdumombasin's answer is elegant in that you can simply copy and paste the soft-hyphen and tag any words you want to remain unformatted with only a single hidden character. The primary different between the two is my solution uses characters that will remain hidden if copy/pasted to a simple text-editor, whereas the soft-hyphen solution in my testing converts to a standard looking hyphen in common simple text-editors.
TL;DR: You now have TWO working solutions for the price of one!
I had to agree with Richard Simões above, none of these answers actually provided a real solution. Though they're all correct in one sense, there is no intentionally built method to handle this use case, it would require a hack of some sort. ...And since none of the hacks provided so far are acceptable I grabbed a hotpocket and some Xena tapes and set out to prove my kung-fu was strong.
Result: My kung-fu was strong.
Solution: Use the Vertical Tab character.
As mentioned above you can use a space to sort of detach the asterisks from the word or phrase they're around, like so:
These * spaces * will keep it from becoming bold.
This in my opinion was the best answer given already, but it still adds the unsightly spaces. So instead if you were to use the Vertical Tab (VT) it would be enough to separate out the asterisk, without adding the additional space between the asterisks and the word(s) they surround.
Here is the character info, though I am unsure how StackExchange and/or your individual web browser will display this. If it automatically converts it to a space, or something similar refer below to an alternate method:
Vertical Tab (between quotes): "" Decimal: 11 Hex: 0x0b
And in a sentence as you would use it on Slack, where I've tested it successfully, regardless of how it works here (just copy/paste into Slack):
There is *no* spoon.
The easiest way I've found to work with non-printable character hacks like this is to save the sequence in a text file as hex, then whenever I need to use them I can quickly open a new tab, google 'hex to ascii', then copy/paste via any converter. I also recommend using a text editor that has the option to show whitespace characters. Here is a string in hex to use, just convert to ascii and replace 'hax' with whatever you mean to type:
But if you, the human, are typing using the Slack client, as others have said, there's no way to produce a string of text surrounded by asterisks. If you don't want other kinds of formatting applied (like
code), here are a few compromises that will get you close to what you want:
* I don't want this to be bold *
\*I don't want this to be bold*
_*I don't want this to be bold*
There is a Unicode character, "Combining Grapheme Joiner" (͏Unicode: U+034F, UTF-8: CD 8F) that, if inserted just before one of the special characters in Slack, somehow nerfs Slack's detection of the special characters:
I don't want *this* to be bold ^- Insert it before this asterisk
trick hack seems to escape the following character, allowing asterisks, tildes, underscores, and (for me most important of all) leading angle brackets to be typed without Slack using them as formatting codes.
I realize that this is a skanky hack: It's relatively easy on a Mac, but I can't speak for my Windows comrades whether this is easy to do or not.
PS: I tried several other Unicode characters, including backspace, thin space, hair space, zero-width space, and so forth, but Slack strips them, at least when they are the 1st character on a line (which makes typing something like
> 9,000! as a comment impossible in Slack, because it becomes a blockquote).
To escape a special character, f.e. * or @, type the following characters right before the character that we want to escape:
Press and release, one after the other, the following characters:
For a moment, we will see, underlined:
which will soon become invisible.
Now you can type the special character.
This answer is given by @Suboptimal in a comment.
I tried to reply to him but the comments do not allow the needed formatting.
If he will post this answer, I will gladly upvote it and remove this one.
Single back ticks will do it, triple back ticks will make it block text . . . but either will format it as code. As confirmed by this tweet by Slack.
`*I don't want this to be bold*`
2021 and I still ended up in this thread, on my Windows PC the CTRL+Z worked, for my phone that didn't so I experimented a bit.
Simplest way I found that works for me on all platforms, add a space after the first asterisk, then after you type the word with the * after it delete the space
I do * not* want bold, then remove the space before "not" and it will keep the asterisk without making it bold:
I do *not* want bold
I’m adding this comment at this late date as this is the first hit from google for “escaping slack markup”, so hopefully my answer might help someone else save a bit of time. It’s also worth noting that I was looking for a solution that works through the Slack API, rather than the editor too.
Quite frankly, the whole Slack mark-up approach is a bit of a mess. Thankfully, the answer from leclercdumombasin put me on the right path to a general solution, so a huge thank-you to them!
For each of the characters Slack treats as a special mark-up token
_*~ etc, if you wrap them in a pair of the soft-hyphen characters as described, then they can appear at the beginning, end, or middle of the text, and can be bracketed with whitespace or otherwise.
So for example to escape an
_ within Unicode UTF-8 text the result would be
I was unable to get any of the above solutions to work for me. We were sending a dash
- character without any other text. It was being removed when sending the message to slack programatically. We found that if we send the dash in its unicode representation we found success
tl;dr Use Unicode Characters