diff --git a/lib/linguist/lexer.rb b/lib/linguist/lexer.rb
index 0bafd280..f38d730b 100644
--- a/lib/linguist/lexer.rb
+++ b/lib/linguist/lexer.rb
@@ -141,7 +141,7 @@ module Linguist
#
# Returns html String
def colorize(text)
- Albino.colorize(text, self)
+ Albino.new(text, self).colorize(:O => 'stripnl=false')
end
# Public: Highlight syntax of text without the outer highlight div
diff --git a/test/test_language.rb b/test/test_language.rb
index 1a9f4108..6a83dbba 100644
--- a/test/test_language.rb
+++ b/test/test_language.rb
@@ -459,6 +459,16 @@ Hello
assert_equal <<-HTML, Language['Ruby'].colorize_without_wrapper("def foo\n 'foo'\nend\n")
def foo
'foo'
+end
+ HTML
+ end
+
+ def test_colorize_doesnt_strip_newlines
+ assert_equal <<-HTML, Language['Ruby'].colorize_without_wrapper("\n\n# Foo\ndef 'foo'\nend\n")
+
+
+# Foo
+def 'foo'
end
HTML
end