Search code examples
reactjscontentful

Can we put underline in single line text field of contentful?


I added one field which is of type text as single line. Now I need to make some of the text as underline.for example:-

He is a good employee.

I want underline in employee text. How can I add that in contentful?


Solution

  • 👋🏻

    When you're using the Markdown editor the problem the problem is not with Contentful but rather the markdown specs themselves. They do not provide the "underline" functionality.

    The question about underline is a common question. The idea of markdown is to only care about content and not really the representation (e.g. "bold" translates to the html strong element which stands syntactically for important parts) though.

    IMO underlined text can also be confused with links too easily.

    If you have to make this work you can either bring in inline HTML (has the downside that you'll loose cross-platform compatibility because not every system can deal with HTML) or you handle the underline functionality in your application consuming Contentful with some CSS for example.

    E.g. assuming that you want to highlight something in your application/website I could see that the "bold"/"strong" meaning could work for you.

    Overall rule of thumb with markdown is thinking of the document structure and content rather then it's appearance. "These are important words in this paragraph" (👍) vs. "These are words that should be underlined" (👎).