From acbf341e84898bff72d51ee861d968f3c7868afd Mon Sep 17 00:00:00 2001 From: Admin Date: Sun, 4 Dec 2022 23:39:26 -0500 Subject: Fix trailing whitespace in tags --- html2md.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'html2md.rb') diff --git a/html2md.rb b/html2md.rb index a5aca09..7b89309 100755 --- a/html2md.rb +++ b/html2md.rb @@ -98,4 +98,7 @@ body_text = if body.at_css('blockquote > div.border') body.children.to_html end +# Fix cases where or tags contain trailing whitespace +body_text.gsub!(/(\*\b[^*]+) +(\*+)/, '\1\2 ') + puts body_text.lines.map(&:strip).join("\n").gsub(/\n\n\n+/, "\n\n") -- cgit v1.2.3