16

Possible Duplicate:
Why can we format text with bold and italic but sideline the underline?

How can I underline text in my questions in Stack Overflow??

This is important for me to format object text like in

my:House

in OOP.

This workaround looks a bit stupid at times but maybe it is worth considering. It uses U+0332COMBINING LOW LINE—after each character to render it underlined

I could not combine a semicolon with an underline, so, these are the results.

t̲e̲x̲t̲
m̲y̲:H̲o̲u̲s̲e̲
 :̲

m̲y̲:̲H̲o̲u̲s̲e̲

m̲y̲:H̲o̲u̲s̲e̲

u̲n̲d̲e̲r̲l̲i̲n̲e̲d̲ t̲e̲x̲t̲

u̲n̲d̲e̲r̲l̲i̲n̲e̲d̲

Reference: Why can we format text with bold and italic but not underline?

0

1 Answer 1

12

Markdown doesn't have a defined syntax to underline text so to answer your question, you can't.

4
  • 9
    Not completely true, you can always use ascii underline - however it looks a bit odd when used on characters that have a part under the line (y,g,q,...) There are existing tools that will do this for you e.g. manytools.org/facebook-twitter/strikethrough-text example: n̲i̲c̲e̲ t̲e̲x̲t̲,̲ u̲g̲l̲y̲O̲n̲e̲ y̲,̲g̲,̲q̲,̲.̲.̲.̲
    – jave.web
    Oct 11, 2014 at 11:27
  • @jave.web That's actually awesome and better than nothing.
    – Avatar
    Dec 17, 2017 at 13:15
  • 1
    It doesn't have to be pure markdown. There's also that subset of allowed HTML. While deprecated, the admins could allow <u>, much as they have for <b> and <i>. But so far, they haven't, for reasons that remain obscure. Mar 4, 2021 at 23:44
  • bookmarklet to underline selected text using UNICODE U+0332 javascript:(function() { var el = document.activeElement; var start = el.selectionStart; var end = el.selectionEnd; var val = el.value; var text = val.substring(start, end).replace(/\S/g, "$&\u0332"); el.value = val.substring(0, start) + text + val.substring(end); el.selectionStart = start; el.selectionEnd = start + text.length; })();,
    – Madacol
    Mar 21 at 14:45

Not the answer you're looking for? Browse other questions tagged .