MD ViewerMD Viewer

100% private — everything runs in your browser

Underline in Markdown

Whether underline in markdown works depends on where your file renders. Test the u tag live, then check the compatibility table and pick the right fallback.

MD Viewer Team

Examples
Markdown source
Preview

Works where HTML is allowed:

underlined text

Underline in markdown is a compatibility story, not a syntax story. The language itself defines no underline — but Markdown documents travel: the same file that renders on GitHub today may pass through a static site generator tomorrow and a strict wiki next week. Whether your underline in markdown survives each hop is decided by one question: does the renderer allow inline HTML? The playground above lets you test both outcomes — the HTML underline example and the pure-Markdown fallback — in one place.

The compatibility split is wider than most writers expect. GitHub, GitLab, Bitbucket, VuePress, Docusaurus, MkDocs, and most modern documentation platforms render <u>text</u> as a real underline. Strict CommonMark demos, some forum engines, and security-hardened wikis strip all HTML, leaving your underline in markdown as visible angle brackets or nothing at all. The table below names names so you can predict behavior before you ship a document.

This page pairs with the markdown underline page, which is the hands-on syntax demo. Here the focus is decisions: which renderers support underline in markdown, which fallbacks preserve meaning when HTML is stripped, and how to write markup that degrades gracefully everywhere — so your emphasis survives pipelines you have not met yet.

Underline in markdown: renderer compatibility

Rendereru tag result
GitHub (GFM)Renders — underline in markdown works in READMEs and issues
GitLab (GFM)Renders — same GFM behavior as GitHub
CommonMark strictNot rendered — the spec has no underline and treats HTML as text
HTML-stripping wikisNot rendered — the tag is removed or shown literally
Docusaurus / VuePressRenders — React/MDX pipelines allow the u element
Pandoc (to HTML)Renders — underline in markdown passes through to HTML

Getting underline in markdown to survive everywhere

  1. 1

    Test on the target renderer first

    Paste the u-tag example where the document will actually live. If the underline in markdown renders, you are in the compatible majority and can stop worrying.

  2. 2

    If HTML is stripped, switch emphasis

    Where underline in markdown is unavailable, bold carries emphasis with zero compatibility risk, and italic does the same for a lighter voice. Both work in every Markdown renderer ever shipped.

  3. 3

    Use underline only where it means underline

    Proper nouns in Chinese documents, printed forms, and legal styling justify underline in markdown; casual emphasis does not. Narrow use shrinks the compatibility surface for free.

  4. 4

    Keep the source readable either way

    Write <u>short spans</u>, not page-length underlines. If a pipeline strips the tags, short spans degrade into plain text gracefully — the underline in markdown disappears, the sentence survives.

Fallback strategies when underline in markdown fails

When a renderer strips HTML, four fallbacks cover nearly every need. Bold is the universal emphasis — no renderer drops it. Italic is its lighter sibling. A code span marks terms distinctly with a tinted background instead of a line. And for documents that truly require an underline glyph — printed contracts, Chinese proper nouns — export the finished document to PDF via the convert md to pdf page and apply the styling at the destination, where typography is under your control rather than the renderer's.

A subtler strategy is structural: if you control the pipeline, choose a renderer that whitelists u. Security policies usually blacklist script-bearing tags while allowing harmless presentational ones — underline in markdown then works by default. This site's own engine takes exactly that approach: sanitize everything, whitelist u, and the compatibility question disappears for every document rendered here.

The one non-strategy is improvising syntax. Underlining with underscores, overloading emphasis markers, or abusing heading styles produces markup that looks underlined in one renderer and broken in three others. Underline in markdown is either the u tag or it is nothing — everything else is a compatibility bug you are planting on purpose.

Compatible alternatives to underline in markdown

__bold pretending to be underline__

**bold** chosen deliberately

Double underscores render bold everywhere. If bold is your real fallback, write it as bold and stop imitating a line that will never appear.

===underlined heading style===

## a proper heading

Some flavors turn underlined lines into headings — that is a heading, not underline in markdown, and it breaks outlines and PDF bookmarks downstream.

<span style='text-decoration:underline'>

<u>text</u>

Inline style attributes are stripped by most sanitizers, including this site's. The bare u tag is the one form of underline in markdown that survives whitelists.

The one-line decision rule

Need underline in markdown and your target renders HTML? Use <u>text</u>. It does not? Use bold and move on. Compatibility problems with underline in markdown come from pretending there is a third option — there is not.

Frequently asked questions

Sources and spec citations

“The <u> HTML element represents a span of inline text which should be rendered in such a way as to indicate that it has a non-textual annotation.”
MDN Web Docs — <u>: The Unarticulated Annotation element
“The <ins> HTML element represents a range of text that has been added to a document.”
MDN Web Docs — <ins>: The Inserted Text element

Related Markdown tools