Skip to content

Keep non-breaking spaces in resulting Markdown #258

@vpratfr

Description

@vpratfr

Version(s) affected

5.1.1

Description

Hi,

We have some HTML generated via some code which contains non-breaking spaces.

Those non-breaking spaces get converted to regular spaces when converting the HTML to markdown (same thing whether we use the   code or the unicode \u00a0 character).

We found no option to preserve those particular spaces. How can we achieve that? We find ourself struggling to keep monetary symbols on the same line as the amount for instance in the final documents.

image

        $str = '<html><p>This is a test and&nbsp;test</p></html>';

        $converter = new HtmlConverter();

        ray(json_encode($str))->red();
        ray(json_encode($converter->convert($str)))->red();

How to reproduce

<html><p>This is a test and&nbsp;test</p></html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions