muchen 牧辰

Facebook Messenger Formatting Syntax

Updated 2019-05-29

Here is a collection of useful formatting tricks (that’s a clickbait word – it’s more just syntax) that you can use in Facebook’s Messenger app.

Note that for the moment, these syntax seems to be only parsed and rendered in the web-application. This means that this is not going to work on native iOS or Android apps. However it will work in web-app through the mobile browser.

Bold and Brash

Enclose the text in a pair of asterisks ( * ) to make the text bold which helps getting your point to everyone by simulating yelling at them. This works anywhere in your message.

bold

Emphasize Italicize

Enclose the text in a pair of underscores ( _ ) to make the text italic. This works anywhere in your message.

italic

Scratch That

Enclose the text in a pair of tilde symbols ( ~ ) to make the text strikethrough. This works anywhere in your message.

strikethrough

Let’s Speak Code

You can send inline code in Messenger by enclosing text using a pair of backticks ( ` ). This works anywhere in your message.

inline code block

Let’s Speak More Code

To send code snippets, we can use a pair of triple backticks ( ``` ) which enables multi-line code. Optionally, you can specify the programming language of the code to enable syntax highlighting. (Note: at the time of writing, syntax highlighting was not working.)

code block

Unlike the fore-mentioned formatting syntax, this code block syntax is not as flexible. You shouldn’t mix normal text and code block text in a single message.

Mathematical

We can write blocks of maths blocks by using a pair of double dollar signs ( $$ ). Messenger parses LaTeX syntax using KaTeX, so we have a lot of flexibility. This is especially useful if someone is explaining homework or something to their classmates. Unfortunately, inline maths is not supported. So make sure to keep everything inside the double dollar signs. Like code blocks, don’t mix normal text with maths text, or LaTeX will not render.

math blocks

Thanks to KaTeX, we can make some crazy LaTeX blocks in Messenger. For example, using \begin{aligned} for aligned multi-line equations. Or using \begin{cases} for cases. And using \begin{bmatrix} for matrices. And much more.

$$
F(x) = \begin{cases}
f(x), & \text{for } 0 \leq x \leq 1 \\
f(x - 1), & \text{for } x > 1 \\
f(x^2 + 1), & \text{for } x < 0
\end{cases}
$$

Turns into

large math block

More More LaTeX

LaTeX offers vastly more text formats and styles that what Messenger natively offers. See this Overleaf article on the full extent of LaTeX font customizations. Some notable examples include:

font sizes

math fonts

World of Color

While messing around with LaTeX, I also discoved that you can use \color to specify the text color for the LaTeX text.

So something like

$$\text{
\color{#f00}{H}\color{#f94}{e}\color{#ff0}{l}\color{#9f4}{l}\color{#2f2}{o} 
\color{#4f9}{W}\color{#0ff}{o}\color{#04f}{r}\color{#40f}{l}\color{#f0f}{d}
}$$

renders into

colored text

Combine everything above and we can get some pretty amazing results.

fabulous text