Fixed wierd gitlab markdown issue
This commit is contained in:
parent
cec866a7ce
commit
2398af9ab0
|
@ -13,10 +13,17 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
|
||||||
options = { options: {encoding: 'utf-8'} }
|
options = { options: {encoding: 'utf-8'} }
|
||||||
options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language)
|
options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language)
|
||||||
|
|
||||||
|
# New lines are placed to fix an rendering issue
|
||||||
|
# with code wrapped inside <h1> tag for next case:
|
||||||
|
#
|
||||||
|
# # Title kinda h1
|
||||||
|
#
|
||||||
|
# ruby code here
|
||||||
|
#
|
||||||
<<-HTML
|
<<-HTML
|
||||||
<div class="#{h.user_color_scheme_class}">
|
|
||||||
#{Pygments.highlight(code, options)}
|
<div class="#{h.user_color_scheme_class}">#{Pygments.highlight(code, options)}</div>
|
||||||
</div>
|
|
||||||
HTML
|
HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -331,9 +331,9 @@ describe GitlabMarkdownHelper do
|
||||||
it "should leave code blocks untouched" do
|
it "should leave code blocks untouched" do
|
||||||
helper.stub(:user_color_scheme_class).and_return(:white)
|
helper.stub(:user_color_scheme_class).and_return(:white)
|
||||||
|
|
||||||
helper.markdown("\n some code from $#{snippet.id}\n here too\n").should == "<div class=\"white\"><div class=\"highlight\"><pre><span class=\"n\">some</span> <span class=\"n\">code</span> <span class=\"n\">from</span> $#{snippet.id}\n<span class=\"n\">here</span> <span class=\"n\">too</span>\n</pre></div></div>"
|
helper.markdown("\n some code from $#{snippet.id}\n here too\n").should include("<div class=\"white\"><div class=\"highlight\"><pre><span class=\"n\">some</span> <span class=\"n\">code</span> <span class=\"n\">from</span> $#{snippet.id}\n<span class=\"n\">here</span> <span class=\"n\">too</span>\n</pre></div></div>")
|
||||||
|
|
||||||
helper.markdown("\n```\nsome code from $#{snippet.id}\nhere too\n```\n").should == "<div class=\"white\"><div class=\"highlight\"><pre><span class=\"n\">some</span> <span class=\"n\">code</span> <span class=\"n\">from</span> $#{snippet.id}\n<span class=\"n\">here</span> <span class=\"n\">too</span>\n</pre></div></div>"
|
helper.markdown("\n```\nsome code from $#{snippet.id}\nhere too\n```\n").should include("<div class=\"white\"><div class=\"highlight\"><pre><span class=\"n\">some</span> <span class=\"n\">code</span> <span class=\"n\">from</span> $#{snippet.id}\n<span class=\"n\">here</span> <span class=\"n\">too</span>\n</pre></div></div>")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should leave inline code untouched" do
|
it "should leave inline code untouched" do
|
||||||
|
|
Loading…
Reference in a new issue