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

don't trim empty text elements

Open Pitasi opened this issue 2 years ago • 0 comments

Hey there :)

I have a pipeline like

markdown -> [comrak] -> html
html -> [html-parser] -> nodes
nodes -> [my-logic] -> html
html

And, it took me a while to figure it out why my code blocks were broken! (Missing tabs, missing newlines, ...) 😅

Finally I realized that empty text blocks are not parsed by html-parsed, but they were not "empty", they were "whitespace only", which are still important inside <pre> so I don't think we should get rid of them this easily!

I tested this PR on my repos and it fixes my problem.

Pitasi avatar Sep 23 '23 16:09 Pitasi