Skip to content

Incomplete decoding of HTML entities #44

@annesnour03

Description

@annesnour03

Hi 👋

Previously, I opened #42 to correctly unescape whitespace HTML entity codes.
However, that the approach already present turned out to be not very scalable, as many valid entities are still not decoded correctly.

For example:

ï  ->  ï
°  ->  °

These entities are automatically decoded in GitHub’s markdown preview, but not in marked-react, which leads to inconsistent rendering in our application (some entities decoded, others not).

Proposed solution

Use html-entities, a lightweight package without dependencies, to safely decode all valid HTML entities.


Example

Input:

Café – temperature: 23°C

Expected output:

Café – temperature: 23°C

Actual output (current):

Café – temperature: 23°C


Would you consider adding this improvement?
I’d be happy to open a PR if this approach sounds good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions