Let's be honest – trying to underline text in Markdown feels like trying to open a pickle jar with buttered fingers. You know it should be simple, but it's weirdly frustrating. I remember spending 45 minutes on a documentation project before realizing my underlines weren't showing up. Turns out Markdown deliberately omits underlining. Why? Because back in 2004, John Gruber designed it to mimic email plain-text formatting where underlines often indicated hyperlinks.
But sometimes you just need an underline! Maybe you're writing a legal document, creating worksheets, or just want visual variety. Whatever your reason, I'll show you real solutions that work across different platforms.
Why Underlining in Markdown Isn't Straightforward
Standard Markdown doesn't have native underlining syntax. Unlike bold (**text**
) or italics (*text*
), there's no shortcut. Why this glaring omission? Three key reasons:
- Historical baggage: Early web browsers displayed links as underlined text by default
- Design philosophy: Markdown prioritizes readability over visual formatting
- Ambiguity prevention: Avoiding confusion between underlined text and hyperlinks
But here's the kicker – modern implementations have evolved. While pure Markdown ignores underlining, many platforms now support extensions. Let's crack this nut properly.
HTML to the Rescue: The Most Reliable Method
When I absolutely need underlines in Markdown documents, I use the HTML <u>
tag. It's ugly but effective. Here's how it looks:
Regular Markdown text with <u>underlined section</u> inside.
Renders as: Regular Markdown text with underlined section inside.
Where this works:
- GitHub README files
- VS Code preview pane
- Most static site generators (Jekyll, Hugo)
- Stack Overflow posts
Where it fails:
- Some minimalist Markdown parsers like SmartyPants
- Plain-text email clients stripping HTML
Not perfect? No. But it gets the job done in 90% of cases. Better than the CSS method requiring style tags that break portability.
Platform-Specific Solutions That Actually Work
Certain flavors of Markdown added custom underline support. Here's what I've tested personally:
Platform | Syntax | Works? | My Experience |
---|---|---|---|
GitHub Flavored Markdown | <u>text</u> only |
✅ Yes | Reliable but limited |
Markdown Extra | _underline_ |
⚠️ Partial | Conflicts with italics |
Obsidian Notes | <u>text</u> |
✅ Yes | Visual editor makes it easy |
Typora Editor | Ctrl+U shortcut |
✅ Yes | Best WYSIWYG experience |
Reddit Comments | Not supported | ❌ No | Will strip your underline attempts |
I switched to Typora for documentation work specifically because of formatting headaches. Their live preview handles underlining perfectly while maintaining clean Markdown underneath.
Common Underline Scenarios Solved
Academic Writing: Underlining Headings
APA format requires underlined headings? Use HTML heading tags with inline CSS:
<h3 style="text-decoration: underline;">Methodology</h3>
Works in Pandoc when converting to PDF/DOCX. Slightly messy but gets past formatting committees.
Creating Fillable PDF Forms
When generating PDFs via Pandoc, underline blank spaces like this:
Name: \underline{\hspace{4cm}}
Uses LaTeX under the hood. Requires —pdf-engine=xelatex
flag.
Underlining in Tables
Got a pricing table needing emphasis? Combine HTML and Markdown:
| Item | Price | |------------|----------| | Basic Plan | $10/month | | <u>Pro Plan</u> | <u>$25/month</u> |
Renders perfectly in GitHub and static sites. Avoid pipe characters inside the <u>
tags or it breaks.
Why You Should Avoid Underlining Alternatives
You'll see folks suggesting workarounds. From experience, most create more problems:
- Bottom borders:
span style="border-bottom:1px solid"
– Causes line-height issues - Underscores:
___underlined___
– Often renders as italics - Hyperlink trickery:
[text](#)
– Creates fake links - Unicode hacks: ▁U̲n̲d̲e̲r̲l̲i̲n̲e̲▁ – Breaks screen readers
Honestly? These "clever" solutions aren't worth the trouble. Stick with semantic HTML unless you enjoy debugging rendering quirks.
FAQs: Underline in Markdown Questions Answered
Can I use underline in GitHub README.md files?
Yes but only through HTML tags. GitHub's Markdown parser supports <u>
tags. Their GFM spec explicitly allows it for underlined text display.
Why doesn't Markdown have native underline syntax?
Historical reasons mostly. Early web conventions used underlines exclusively for links. Gruber maintained this distinction to prevent ambiguity in rendered documents.
Are there any Markdown editors with built-in underline support?
Several! Typora (Win/Mac/Linux) supports Ctrl+U underline shortcuts. Obsidian's live preview respects <u>
tags. VS Code shows underlines if you install the "Markdown All in One" extension.
How to underline in markdown without HTML?
Practically speaking? You can't reliably. Some flavors like Markdown Extra support _underline_
but compatibility is spotty. For cross-platform docs, HTML remains the only safe bet.
Does underline in markdown work on mobile apps?
Depends on the app. iA Writer (iOS) shows underlines from HTML tags. Markor (Android) doesn't by default but can with plugins. Test before committing!
Portability Considerations Across Platforms
Here's the rub – your underlined Markdown might look perfect in Typora but vanish when pasted elsewhere. After losing formatting one too many times, I made this reference chart:
Platform | HTML Tag Support | Custom Syntax Support | Recommendation |
---|---|---|---|
GitHub/GitLab | ✅ Full | ❌ None | Use <u> tags |
Notion | ❌ Stripped | ❌ None | Avoid underlining |
Slack | ❌ Stripped | ❌ None | Use *bold* instead |
WordPress | ✅ Full | ✅ Via plugins | HTML or editor buttons |
Confluence | ⚠️ Partial | ✅ {+underlined+} | Use their custom macros |
My workflow rule: if the document will live in multiple places, either avoid underlining altogether or provide both formatted and plain-text versions.
The CSS Alternative (Use With Caution)
For websites built with Markdown (like Jekyll/Hugo), you can add CSS rules:
/* Underline only headings */ .post-content h2 { text-decoration: underline wavy #3498db; }
Creates blue wavy underlines under all H2s. Powerful but has downsides:
- Only works for published HTML
- Breaks Markdown portability
- Requires CSS knowledge
I use this for blog titles but never for inline text – too fragile.
When Not to Underline in Markdown
After all this talk about implementing underlines, let's acknowledge something: often you shouldn't. Modern UX considers underlines problematic:
- Accessibility issues – underlines decrease readability for dyslexic users
- Hyperlink confusion – especially in technical documentation
- Visual clutter – underlines compete with other dividers
In my client work, I suggest alternatives 80% of the time:
- Instead of underlining headings → Increase font weight
- Instead of underlining key terms → Use bold or highlight colors
- Instead of underlining labels → Use pill badges
Ironically, learning how to underline made me use it less. Most times, there's a better design choice.
Future of Underlining in Markdown
The CommonMark specification (modern Markdown standardization effort) still doesn't include native underlining. But there's movement:
- Markdown Extended proposes
{+underlined text+}
- GitHub is experimenting with ::underlined:: syntax internally
- Pandoc supports underlines via LaTeX extensions
My prediction? Within 3-5 years we'll see widespread standardized support. Until then, HTML tags remain the most portable solution despite the syntax ugliness.
Final thought: if you only remember one thing from this guide, let it be this – always test your underlines in the target platform before finishing the document. Nothing's worse than discovering missing formatting after submission. Trust me, I've been there!
Leave a Message