WhatsApp and Markdown-ish?
Posted: | Updated: | Tags: statusMarkdown is a neat and simple way to format text using a basic editor. You’ll have come across it on various different forums, instant messaging apps, and blogging platforms among other places where text fields are used. It was created by John Gruber in 2004 and had then been adopted across different platforms but lacked a standardised implementation. To address these inconsistencies, Jeff Atwood, John MacFarlane, and others have formed a group in an effort to standardise. Since 2014, text/markdown
is now a recognized MIME type, and CommonMark was released which is the specification and test suite we need!
CommonMark has been adopted on many platforms and programming libraries since. Many do not mean all, so why this post? It’s WhatsApp. The reason I started looking into Markdown and its specifications was WhatsApp. I strongly dislike that WhatsApp breaks from the specification for bold text. As per the spec:
Markdown treats asterisks (*) and underscores (_) as indicators of emphasis. Text wrapped with one * or _ will be wrapped with an HTML
<em>
tag; double *’s or _’s will be wrapped with an HTML<strong>
tag.
This means text written like *this*
or _this_
in Markdown will be translated to this, italicised. Whereas text is written like **this**
or __this__
will appear like this, in bold.
WhatsApp, rubbing against the grain, only permits text wrapped with a single asterisk to be bold, while text wrapped in a single underscore to be italics. I wanted to compare this to other messaging platforms and so created the following table. It is not an extensive list of all supported options for each platform, as Slack, Discord, and Telegram have some more.
Markdown1 | WhatsApp2 | Slack3 | Discord4 | Telegram5 | |
---|---|---|---|---|---|
Heading 1 | # text | ❌ | ❌ | # text | ❌ |
Heading 2 | ## text | ❌ | ❌ | ## text | ❌ |
Heading 3 | ### text | ❌ | ❌ | ### text | ❌ |
Heading 4 | #### text | ❌ | ❌ | ❌ | ❌ |
Heading 5 | ##### text | ❌ | ❌ | ❌ | ❌ |
Heading 6 | ###### text | ❌ | ❌ | ❌ | ❌ |
Bold | **text** or __text__ | *text* | *text* or **text** | **text** | **text** |
Italic | *text* or _text_ | _text_ | _text_ or __text__ | _text_ | __text__ |
Blockquotes | > text | > text6 | > text | > text | ❌ |
Ordered lists | 1. text | 1. text6 | 1. text | ❌ | ❌ |
Unordered lists | - text or * text | - text or * text6 | * text | - text or * text | ❌ |
Code | `text` | `text`6 | `text` | `text` | `text` |
Code blocks | ```text ``` (extended) | ```text``` | ```text``` | ```text``` | ```text``` |
Links | [text](http://example.com) | ❌ | [text](http://example.com) | [text](http://example.com/) | ❌ |
Strikethrough | ❌ | ~~text~~ | ~~text~~ |
It was WhatsApp divergence from the standard that prompted me to create this comparison but as shown in the table, there are other offenders! Take for instance Telegram, the messaging service only permits double underscores to be italics. I could find a concrete reason why these applications chose to implement Markdown this way but would be interested to see if others have similar examples.
CommonMark Spec spec.commonmark.org ↩︎
WhatsApp - How to format your messages faq.whatsapp.com ↩︎
Slack - Format your messages slack.com ↩︎
Discord - Markdown Text 101 (Chat Formatting: Bold, Italic, Underline) support.discord.com ↩︎
Telgram - MarkdownV2 style core.telegram.org ↩︎
Update 2023-12-17: I’ve just stumbled on some new supported syntax, these apply for blockquotes, ordered and unordered lists and code. The WhatsApp FAQ has been updated to read “New text formatting is only available on iOS and Web.” I’ve confirmed on my Android phone I can simply see the plaintext version if any of the new formatting is used. ↩︎ ↩︎ ↩︎ ↩︎