I am using BlueCloth as a Markdown library for Ruby, and I can't find any syntax for getting a text underlined. What is it?
9 Answers
Another reason is that <u>
tags are deprecated in XHTML and HTML5, so it would need to produce something like <span style="text-decoration:underline">this</span>
. (IMHO, if <u>
is deprecated, so should be <b>
and <i>
.) Note that Markdown produces <strong>
and <em>
instead of <b>
and <i>
, respectively, which explains the purpose of the text therein instead of its formatting. Formatting should be handled by stylesheets.
Update:
The <u>
element is no longer deprecated in HTML5.
(this answer rewritten since the downvotes)
Just use the HTML <u>
tag (recommended) or the <ins>
tag inside your markdown for this.
The HTML tag <ins>
is the HTML "insert tag", and is usually displayed as underlined. Hence, you can use it for underlining, as @BlackMagic recommends in his answer here. It is the opposite of the <del>
delete tag.
But, I'd prefer and I recommend to just use the HTML <u>
underline tag, since that's exactly what it's for:
<u>this is underlined text in HTML or markdown, which accepts HTML</u>
@zed_0xff also recommends using the <u>
tag in his answer here.
You can try it out live online here: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_u.
Can I use CSS too?
It depends. On your custom Jekyll website? Sure. In GitHub readmes and other GitHub markdown files? No!
HTML tags work fine in GitHub readmes too, because GitHub accepts HTML tags just fine. BUT, custom CSS in GitHub does NOT work since GitHub blocks and rejects all custom CSS you may try to add. I talk about this in my other answer here: GitHub README.md center image.