diff --git a/lib/rouge/formatters/html_table.rb b/lib/rouge/formatters/html_table.rb
index fa9a181df8..d845402f84 100644
--- a/lib/rouge/formatters/html_table.rb
+++ b/lib/rouge/formatters/html_table.rb
@@ -26,7 +26,7 @@ def stream(tokens, &b)
formatted = @inner.format(tokens)
unless last_val && last_val.end_with?(?\n)
num_lines += 1
- formatted << ?\n
+ formatted << ?\n unless formatted.end_with?(?\n)
end
# generate a string of newline-separated line numbers for the gutter>