-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
Coming from forem/forem#8457, I think that ReverseMarkdown strips too much blankspace in some scenarios. Here's a failing test:
it 'keeps whitespace surrounding links' do
result = ReverseMarkdown.convert("a\n<a href='1'>link</a>\nis good\nbut blankspace is better")
expect(result).to eq "a [link](1) is good but blankspace is better\n\n"
endThe output is a[link](1)is good but blankspace is better\n\n. This happens because the text converter calls remove_border_newlines, and the fact that the middle line is a link means that it will be its own nokogiri node, and the three nodes will be joined with no whitespace. I tried changing remove_border_lines to squeeze instead of removing everything, but this doesn't work: it keeps whitespace in scenarios where it shouldn't:
first<p>second</p>third becomes first\n\nsecond\n\n third\n\n.
I still want to investigate this further, but I decided to post this now to share my findings.
Metadata
Metadata
Assignees
Labels
No labels