TransWikia.com

How do I escape formatting characters in Slack?

Web Applications Asked by BadHorsie on December 18, 2020

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*

12 Answers

For the current WYSIWYG editor, hit Ctrl+Z immediately after conversion happened. For example:

abc *def* ghi

will result in

abc def ghi

On the other hand,

abc *def*<CTRL+Z> ghi

will result in

abc *def* ghi

This works for formatting only, not for Slack Emojis.

Correct answer by user2009388 on December 18, 2020

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 xc2xad_xc2xad

Answered by Buffoonism on December 18, 2020

To escape a special character, f.e. * or @, type the following characters right before the character that we want to escape:

Keep pressed:

<ctrl><shift>

Press and release, one after the other, the following characters:

u a d

Release:

<ctrl><shift>

For a moment, we will see, underlined: uAD 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.

Answered by salvador on December 18, 2020

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

This 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).

Answered by Dave Land on December 18, 2020

Maybe use the Unicode U+066D (٭) character when you mean the * character?

The solution above in which the contributor recommends using the vertical tab character worked for me until I also included markup which used the .. syntax, at which point it did not.

Answered by cjac on December 18, 2020

Solution

Copy and paste the text below and change the word in the asterisks for your own needs:

*bold*­

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.


Explanation

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 (&shy;, U+00AD)

This "embeds" the asterisk and thus renders it inactive. Soft hyphen seems like a good character here.

Answered by leclercdumombasin on December 18, 2020

You can enter a Hash with a space, then the text, then use backspace to connect the two.

I.e.

Start with......# SlackIsGreat

Then put the cursor at the 'S" and press backspace.

Answered by Eric on December 18, 2020

UPDATE!: (2017-12-07)

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!


ORIGINAL POST:

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:

2a0b6861780b2a

Answered by ShaneB on December 18, 2020

Another option is to double one of the asterisks.

*cough** and **cough* both work for me in my testing.

Answered by Matt on December 18, 2020

There is only one way to achieve what you want: Use a bot to create messages using the Slack API. Here's a page with an example showing how to do exactly what you want.


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:

spaces (I find this more readable anyway)

* I don't want this to be bold *

leading backslash or underscore

*I don't want this to be bold*

_*I don't want this to be bold*

Answered by jsejcksn on December 18, 2020

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.

Answered by pkoepke on December 18, 2020

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*`

Answered by Tom Woodward on December 18, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP