diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb
index 3c5ca1ce..3a430e0b 100644
--- a/lib/redcarpet/render/gitlab_html.rb
+++ b/lib/redcarpet/render/gitlab_html.rb
@@ -13,10 +13,17 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
options = { options: {encoding: 'utf-8'} }
options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language)
+ # New lines are placed to fix an rendering issue
+ # with code wrapped inside
tag for next case:
+ #
+ # # Title kinda h1
+ #
+ # ruby code here
+ #
<<-HTML
-
- #{Pygments.highlight(code, options)}
-
+
+ #{Pygments.highlight(code, options)}
+
HTML
end
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb
index 1eafc666..f0b792fc 100644
--- a/spec/helpers/gitlab_markdown_helper_spec.rb
+++ b/spec/helpers/gitlab_markdown_helper_spec.rb
@@ -331,9 +331,9 @@ describe GitlabMarkdownHelper do
it "should leave code blocks untouched" do
helper.stub(:user_color_scheme_class).and_return(:white)
- helper.markdown("\n some code from $#{snippet.id}\n here too\n").should == "some code from $#{snippet.id}\nhere too\n
"
+ helper.markdown("\n some code from $#{snippet.id}\n here too\n").should include("some code from $#{snippet.id}\nhere too\n
")
- helper.markdown("\n```\nsome code from $#{snippet.id}\nhere too\n```\n").should == "some code from $#{snippet.id}\nhere too\n
"
+ helper.markdown("\n```\nsome code from $#{snippet.id}\nhere too\n```\n").should include("some code from $#{snippet.id}\nhere too\n
")
end
it "should leave inline code untouched" do