Get Underlined Text with Markdown

how to get the text-underline from strapi articles to my gatsby frontend

Have you tried using your own rendering component (components)?

  <ReactMarkdown 
children={content}
components={{
u: ({node, ...props}) => <u style={{textDecoration: 'underline'}} {...props} />
}}
className={s.content}
transformImageUri={uri => uri.startsWith("http") ? uri : `${process.env.GATSBY_IMAGE_BASE_URL}${uri}`}
/>

More details about components property: https://github.com/remarkjs/react-markdown#appendix-b-components

You can even use a custom-styled <p> instead of <u> if needed. The idea relies on parsing the <u> tag to add your own underlined component.


Apparently, it is needed to install rehype-raw plugin to allow ReactMarkdown to understand and interpret underlined tags (<u>)

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

/p>

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" ().

Rmarkdown knit pdf - getting underlined text instead of italic using *italic* (huxtable issue?)

From the TeXnical perspective the problem is that the ulem package is loaded without the normalem option. A couple of workarounds:

  • use classoption: normalem (based on Knitr hook to add code before \documentclass line in tex file to avoid options clash with xcolor). Caveat: this will pass the option to all packages and might be undesired in case the same option name is also used by other packages (I'm not aware of any other package that uses this option, but just in case ...)

  • add \normalem either as header-include or at the start of your document

Can the PostbackUrl be set for a GridView CommandField?

Leppie is right. The GridView has no PostbackUrl property. However, you can do what you want by using a standard control, which has a PostbackUrl property.

<asp:TemplateField AccessibleHeaderText="Edit">
<ItemTemplate>
<asp:Button runat="server" ID="btnEdit" PostBackUrl="~/Default.aspx" OnClientClick='form1.ActivityId.value = this.Tag;' Tag='<%# Eval("ActivityId") %>' Text="Edit"/>
</ItemTemplate>
</asp:TemplateField>

In this sample code, I added a TemplateColumn to the GridView. I use a dynamically added Tag attribute for the button to pass the Id, then I use Javascript code to put the value in a hidden field, and then the button simply postsback to the page specified in the PostbackUrl property.



Related Topics



Leave a reply



Submit