Skip to content

Feature request: Parse <u> tags as underline instructions #352

@karaken12

Description

@karaken12

Problem background

We have just switched to using react-native-enriched-markdown to render markdown produced by our Strapi CMS. This generally works well, and supports more formatting options than our previous library, but it does not currently support the way that Strapi produces underlines, which is by using <u>...</u> tags. This is technically valid CommonMark Markdown, as laid out in the Raw HTML section of the specification, but RNEM does not render these as underlines, or consume the tag and render the text without formatting, but instead renders the tags as text:

An example of some markdown produced by Strapi and rendered using RNEM, showing underline tags rendered as text

Suggested solution

I would like to see RNEM parse <u> tags as underlines, and style them in the same way as the existing underlined elements.

Input text Output
The middle <u>two words</u> are underlined The middle two words are underlined

Alternative solution

Alternatively, if that is not possible, the <u> tags should be silently discarded and the text rendered as if no style had been specified.

Input text Output
The middle <u>two words</u> are plain The middle two words are plain

Additional context

According to the letter of the CommonMark specification, this should apply to all raw HTML tags provided to the parser. That would clearly be a broader change to RNEM, so I'm restricting this feature request to our specific use case. I will, however, mention a similar suggestion about <br/> tags which shares some aspects of this request.

Note that the GitHub Flavoured Markdown specification should allow <u> tags, but in fact they are consumed and the output is the same as the alternative solution above. The GitHub Markdown docs say to use <ins> tags instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions