Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep non-breaking spaces in resulting Markdown #258

Open
vpratfr opened this issue Dec 19, 2024 · 0 comments
Open

Keep non-breaking spaces in resulting Markdown #258

vpratfr opened this issue Dec 19, 2024 · 0 comments

Comments

@vpratfr
Copy link

vpratfr commented Dec 19, 2024

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant