html-to-md icon indicating copy to clipboard operation
html-to-md copied to clipboard

Deleting spaces

Open dddominikk opened this issue 2 years ago • 1 comments

There's an edge case wherein the library can produce markdown lacking spaces, thus joining words, which is rarely intended behavior.

E.g., this:

This  was a <b>good </b>year.

Outputs this:

This was a **good**year.

I've managed to fix this by preprocessing html with a simple, deterministic regular expression:

htmlString,replace(/(\x20)((?:<\/\w+>)+)(\S)/g,'$2$1$3')

That said, doing so might be outside the scope of this project. So, I'm basically just opening this issue to ask if you're accepting pull requests of this sort. Cheers!

dddominikk avatar Dec 22 '23 17:12 dddominikk

@dddominikk I will try to solve it within the scope of project recently, thanks for the report and suggestion!

stonehank avatar Jan 05 '24 03:01 stonehank