Skip to content

Why the inline style is not correctly parsed? #159

@rallona

Description

@rallona

Executing this code:

const htmlInput = '<p ><span style="white-space:pre-wrap">TEXT</span></p>';
const htmlToReactParser = new HtmlToReactParser();
const reactElement = htmlToReactParser.parse(htmlInput);
const reactHtml = ReactDOMServer.renderToStaticMarkup(reactElement);

I get this as parsed:

<p><span style="white-space:pre-wrap">TEXT</span></p>

But the correct JSX should be:

<p><span style={{ whiteSpace: 'pre-wrap' }}>TEXT</span></p>

Problems rendering the style.

Any solution to this? Thanks in advance!

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