Skip to main content

Text Formatting

3 min readStableBeginner

Inline formatting means wrapping a marker around the words you want changed. CommonMark covers bold and italic; GFM adds strikethrough. For backticks and code spans, see Inline Code.

Quick Start

Two asterisks make text bold, and one underscore makes it italic.

Bold text and italic text.

emphasis.md
Markdown
**Bold text** and _italic text_.

Adding Options

Strikethrough and combined markers

Two tildes strike text through, and nesting the markers gives you bold and italic at once.

Strikethrough marks content that no longer applies, and bold italic carries both weights together.

strikethrough-and-combined.md
Markdown
~~Strikethrough~~ marks content that no longer applies, and **_bold italic_**
carries both weights together.

Order does not matter when you nest: **_x_** and _**x**_ produce the same bold italic result. A single tilde strikes through as well, which github.com allows and the GFM spec does not, but Prettier doubles it the moment you save:

single-tilde.txt
Plain Text
~one~           renders struck through, then gets rewritten to ~~one~~

Marker alternatives

Asterisks and underscores are interchangeable for bold and italic, and three of either gives you both at once. Prettier normalizes all of it to _ for italic and ** for bold on save, so these forms have no live example:

alternatives.txt
Plain Text
*italic*        same output as _italic_
__bold__        same output as **bold**
***both***      same output as **_both_**
___both___      same output as **_both_**

The two markers part ways inside a word. Underscores stay literal there, which is what keeps identifiers readable, while asterisks still apply.

An identifier like snakecase_name survives untouched, but ab_c italicizes the middle letter.

intraword.md
Markdown
An identifier like snake_case_name survives untouched, but a*b*c italicizes the
middle letter.

Advanced

Escaping a marker

A backslash before a marker prints that character instead of applying it. The same trick works on brackets, pipes, tildes, and backticks.

Dropped in v2 puts bold inside strikethrough. To show a marker rather than apply it, escape it: *not italic*, **not bold**, and ~~not struck~~.

escaping.md
Markdown
~~**Dropped in v2**~~ puts bold inside strikethrough. To show a marker rather
than apply it, escape it: \*not italic\*, \*\*not bold\*\*, and \~\~not
struck\~\~.

Line breaks

A single newline in the source is just a space in the output. End a line with a backslash to force a real break without starting a new paragraph.

Ship checklist for v2.1:
Tag the release, then publish.

line-break.md
Markdown
Ship checklist for v2.1:\
Tag the release, then publish.

Two trailing spaces do the same job, and this repo's .editorconfig turns off trailing-whitespace trimming for .md and .mdx so they survive a save. The backslash is still the better habit, since nobody can see two spaces in a review.

Character references

Named and numeric HTML entities are decoded, which is the way to type characters your keyboard lacks.

Copyright © 2026 — all rights reserved  •  terms & conditions apply.

entities.md
Markdown
Copyright © 2026 — all rights reserved  •  terms &
conditions apply.

Write the entity inside a code span, as in ©, when you want the source form to show instead.

What is not available

Subscript and superscript are absent, and the subscript attempt fails quietly rather than loudly.

unsupported.txt
Plain Text
H~2~O           the tilde pair strikes the 2 through: H2O with a line on it
x^2^            no meaning at all; prints exactly as typed

Raw HTML is no fallback either. Pages compile as MDX, so <sub> and <b> are read as React components rather than tags, and the build fails when no component by that name exists.

Options

**text**marker

Bold. Two asterisks on each side. __text__ is the same.

_text_marker

Italic. One underscore on each side. Use asterisks instead for mid-word emphasis, since underscores inside a word such as snake_case_name stay literal.

~~text~~marker

Strikethrough. A GFM extension, not part of core CommonMark.

~text~marker

Strikethrough with a single tilde. Works here and on github.com, though the GFM spec prohibits it.

**_text_**marker

Bold and italic together. Nest the two markers in either order, or write ***text***.

\*escape sequence

A backslash before a marker renders that character literally. Works on *, _, ~, `, [, ], and |.

\ (line end)hard break

A trailing backslash forces a line break inside a paragraph. Two trailing spaces do the same.

©character reference

Named and numeric HTML entities are decoded to their characters.

Was this page helpful?