How to underline text in reStructuredText?

Alex Bolotov picture Alex Bolotov · Jan 31, 2012 · Viewed 12.2k times · Source

Of course, on the web an underline denotes hyperlink, but what if I need underline which is not a hyperlink?

Answer

gozzilli picture gozzilli · Feb 1, 2012

I asked a similar question here. Try like this:

.. role:: underline
    :class: underline

In the document, this can be applied as follows:

:underline:`This text is underlined`

In your css file you could have:

.underline {
  text-decoration: underline;
}

This should work for HTML output. However, underlining is intentionally not part of the ReST specs. See this link.