NanoFile

Markdown underline

There is no markdown syntax for underlining, and that is deliberate. On the web an underline means a link, so markdown left it out. When you genuinely need one, HTML is the answer.

The HTML that works nearly everywhere
<u>underlined text</u>

underlined text

Markdown files may contain HTML, and almost every renderer passes this straight through.

What people usually want instead
**bold for emphasis**

*italic for a title or a term*

bold for emphasis

italic for a title or a term

The one place <u> will not work is a renderer that strips HTML for safety, which is common in comment fields and chat apps. Discord and Slack both ignore it. If your text has to survive there, use bold or italic.

What usually goes wrong

  • Two underscores give bold, not underline. __text__ is the same as **text**, which surprises people coming from word processors every single time.
  • In a strict CommonMark renderer with HTML disabled, <u> is shown as literal text.
  • Underlining non-link text on a web page is a usability problem regardless of how you produce it: readers try to click it.

Where it behaves differently

PlatformBehaviour
GitHub<u>text</u> renders as an underline.
DiscordDiscord has its own: __text__ underlines rather than bolds.
Obsidian<u> works, and there is a setting for underline as __.

Questions

Why does markdown have bold and italic but no underline?

John Gruber designed markdown for the web, where an underline reads as a hyperlink. Leaving it out avoids that confusion. HTML is the escape hatch for the rare case where you need it.

Related