Why Markdown has no underline marker
Core Markdown syntax covers common structures such as headings, paragraphs, links, emphasis, lists, and code. Underlining was not included as a portable text marker. The underscore character has another role: paired underscores can create emphasis in many Markdown implementations. Writing __word__ usually produces strong emphasis, not an underline. A single underscore inside ordinary text may remain visible or become part of an emphasis pattern depending on its position. Do not use underscore characters as a visual substitute for a line beneath text. They can alter parsing and make source content harder to read. First decide whether you need visual decoration or semantic emphasis. If the message means importance, use **important**. If it means a clickable destination, use a Markdown link.
Using inline HTML
When the renderer permits inline HTML, write <u>underlined text</u>. This creates an HTML u element, which browsers commonly display with a line beneath the content. HTML support is a policy choice. Some Markdown tools pass the element through, while others escape it, remove it, or sanitize its attributes. A class-based form such as <span class="underline">text</span> also needs CSS and is less portable. Avoid putting style attributes in content unless the publishing system explicitly allows them. Underline can be confused with a link, so reserve it for conventional meanings such as spelling annotations, names, or visual marks in a controlled interface. Test keyboard navigation and contrast when the content is displayed by a web application.
Choosing a safe alternative
For portable Markdown, replace underline with a supported construct. Use *text* for emphasis, **text** for stronger emphasis, or [text](URL) for a destination. Code formatting with backticks is for literal code, not decoration. If a design requires underlines across a site, define the style in the site's template or stylesheet rather than embedding ad hoc HTML in every document. A content management system may offer a rich-text underline control that produces HTML or a structured format. Exported Markdown can lose that formatting, so inspect the result after conversion. In team documentation, record the renderer and its HTML policy. This avoids inconsistent output when contributors use different editors or when a build pipeline changes sanitization settings.
How do you do it step by step?
- 1Identify whether the text needs semantic emphasis, a hyperlink, or only a visual underline.
- 2Use Markdown emphasis or a link when that meaning matches the content.
- 3Use <u>text</u> only when the target renderer documents support for inline HTML.
- 4If a site needs repeated underlines, define the visual rule in its template or CSS.
- 5Preview the final page and check that the line does not mislead readers or disappear during sanitization.
Working example
The first line uses HTML for a visual underline. The second line uses Markdown for semantic emphasis.
<u>Review this label</u> **Review this important instruction**
A renderer that permits HTML displays the first label with an underline. The second line displays strong emphasis through the renderer's normal Markdown styling.
HTML may be escaped or removed. Do not depend on the first result without testing the exact editor and publishing system.
Frequently asked questions
- Can I underline text with underscores?
- No. Underscores are Markdown punctuation for emphasis in many parsers. They do not provide a reliable underline effect.
- Is the HTML u element valid in Markdown?
- Many Markdown processors accept inline HTML, but acceptance and sanitization vary. The target platform decides whether the element remains in the output.
- Should I underline important words?
- Usually use strong emphasis instead. Underlines often resemble links and can confuse readers when they do not identify navigation.
- How can I underline text across a documentation site?
- Use the site's template or stylesheet when you control the presentation layer. This keeps content separate from repeated visual rules.