How to make a word underline in Markdown

39,864

Solution 1

since markdown is a markup language and In fact you can use HTML/CSS inside it, the easiest way I've found so far is:

text here <span style="text-decoration: underline">underlined text</span> other text

Note: you can still use markdown syntax inside the <span> tag.

Solution 2

In Jupyter notebook, you can use the following to get underscored text

<u>underscored text </u>

Solution 3

you can just use HTML markups in mark down.

if you want to underline, italic or strong, use follows,

<u> this is underlined </u> 

<i> this is italic </i> 

<strong> this is strong </strong>

etc..

Solution 4

Using a plugin (markdown-it-ins)

You can use ++Underlined Text++ to make text underlined in markdown-it.js. Bear in mind that this is not standard markdown and might not work elsewhere. Here's a demonstration of this working in the markdown-it website.

This syntactic extension (inserted text) is added by a plugincalled markdown-it-ins. It's enabled by default in the demo page, but you might need to install and enable it manually for your own page.

Using HTML tags inside markdown

If you want this to work for any markdown parser, you should try using the <u> HTML tag, as most parsers will actually parse HTML inside markdown (this might cause a few unwanted side-effects). markdown-it supports it, if you enable the related option. Here's an example of this in action.

Share:
39,864

Related videos on Youtube

RENU SINGH
Author by

RENU SINGH

Updated on September 24, 2021

Comments

  • RENU SINGH
    RENU SINGH over 2 years

    How to make a word underline in Markdown?

    For example: bold = **bold** or __bold__, italic = *Italic* or _Italic_.

    I have tried with 2 and 3 underscores, but it is not working. Also tried by taking the reference of markdown-it.js.

    • jonrsharpe
      jonrsharpe almost 7 years
      Markdown doesn't have underline, see e.g. softwareengineering.stackexchange.com/questions/207727/…
    • abhishekkannojia
      abhishekkannojia almost 7 years
      Try using ++Underline Me++ markdown-it.js documentation has this.
    • RENU SINGH
      RENU SINGH almost 7 years
      For bold =__bold__ or bold and Italic = Italic or Italic I have tried
    • RENU SINGH
      RENU SINGH almost 7 years
      tried ++underline me++ is also not working .
    • abhishekkannojia
      abhishekkannojia almost 7 years
      @RENUSINGH Are you using markdown-it.js for parsing ? Or you just took the syntax reference from there. If you are not using markdown-it.js then I guess it won't work. Or you can try using the standard HTML <u> tag and see if it works.
    • RENU SINGH
      RENU SINGH almost 7 years
      I am not using markdown-it.js. It's just syntax over here ....
  • Sergio Tulentsev
    Sergio Tulentsev almost 7 years
    This doesn't work in stackoverflow's markdown, for example. At the very least, it's non-standard.
  • Angelos Chalaris
    Angelos Chalaris almost 7 years
    @SergioTulentsev you're right about that. I am looking for actual documentation to support this. I know it works in markdown-it.js, because I have used it and tried it just now, however I cannot find the documentation for it.
  • abhishekkannojia
    abhishekkannojia almost 7 years
    @AngelosChalaris It's there on there demo page, but couldn't find any documentation related to this.
  • Angelos Chalaris
    Angelos Chalaris almost 7 years
    @abhishekkannojia Thanks for mentioning this, it helped me identify where it comes from (a plugin for inserted text).
  • vancy-pants
    vancy-pants almost 5 years
    This worked for me! Is there a reason why someone wouldn't want to use this?
  • Hocine Abdellatif Houari
    Hocine Abdellatif Houari almost 5 years
    probably some people may want to keep things as clean as possible, using html somehow is like a walk around.
  • lacostenycoder
    lacostenycoder about 4 years
    This seems to be supported by Github
  • AntLaC
    AntLaC almost 4 years
    to help keep it clean you can use a CSS class .underline-me {text-decoration: underline;}
  • zylstra
    zylstra about 3 years
    "Is there a reason why someone wouldn't want to use this?" Yeah, because it hasn't worked in any markdown form I've ever come across, Github being the prime example. And maybe because your workaround is so cumbersome? It really blows my mind how anybody does not see that this is needed.
  • Clement
    Clement over 2 years
    This does not work in standard markdown.
  • Hermes Morales
    Hermes Morales about 2 years
    I tried it in Google colab with Python and it works
  • Mooks
    Mooks about 2 years
    This is specific to quarto / rmarkdown and OP doesn't appear to be using those.