summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhtml2md.rb3
1 files changed, 3 insertions, 0 deletions
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 <em> or <i> tags contain trailing whitespace
+body_text.gsub!(/(\*\b[^*]+) +(\*+)/, '\1\2 ')
+
puts body_text.lines.map(&:strip).join("\n").gsub(/\n\n\n+/, "\n\n")