diff --git a/lib/reverse_markdown/converters/text.rb b/lib/reverse_markdown/converters/text.rb index 27e40b1..b6977b5 100644 --- a/lib/reverse_markdown/converters/text.rb +++ b/lib/reverse_markdown/converters/text.rb @@ -48,7 +48,7 @@ def remove_border_newlines(text) end def remove_inner_newlines(text) - text.tr("\r\n\t", ' ').squeeze(' ') + text.tr("\r\t", ' ').squeeze(' ') end def preserve_keychars_within_backticks(text) diff --git a/spec/lib/reverse_markdown/converters/pre_spec.rb b/spec/lib/reverse_markdown/converters/pre_spec.rb index 18f8a9f..02ac94c 100644 --- a/spec/lib/reverse_markdown/converters/pre_spec.rb +++ b/spec/lib/reverse_markdown/converters/pre_spec.rb @@ -12,10 +12,15 @@ expect(converter.convert(node)).to include " puts foo\n" end - it 'preserves new lines' do + it 'preserves new lines as
' do node = node_for("
one
two
three
") expect(converter.convert(node)).to include "\n\n one\n two\n three\n\n" end + + it 'preserves new lines as
and \n' do + node = node_for("
one\ntwo\nthree
four
") + expect(converter.convert(node)).to include "\n\n one\n two\n three\n four\n\n" + end it 'handles code tags correctly' do node = node_for("
foobar
") @@ -41,6 +46,11 @@ expect(converter.convert(node)).to include "```\nfoo\nbar\n```" end + it 'preserves new lines as
and \n' do + node = node_for("
one\ntwo\nthree
four
") + expect(converter.convert(node)).to include "```\none\ntwo\nthree\nfour\n```" + end + it 'handles code tags correctly' do node = node_for("
foobar
") expect(converter.convert(node)).to include "```\nfoobar\n```"