Commit cec866a7cee86a0f56a5c1f0b11d2c19b61947e8

Authored by Dmitriy Zaporozhets
1 parent ed35ea70

Improve wiki rendering. Fix pygemnt + markdown invalid html

app/assets/stylesheets/gitlab_bootstrap/files.scss
@@ -43,11 +43,15 @@ @@ -43,11 +43,15 @@
43 padding: 0 4px; 43 padding: 0 4px;
44 } 44 }
45 padding: 20px; 45 padding: 20px;
46 - h1, h2 {  
47 - line-height: 46px;  
48 - }  
49 - h3, h4 {  
50 - line-height: 40px; 46 +
  47 + h1 { font-size: 26px; line-height: 46px; }
  48 + h2 { font-size: 22px; line-height: 42px; }
  49 + h3 { font-size: 20px; line-height: 40px; }
  50 + h4 { font-size: 18px; line-height: 32px; }
  51 + h5 { font-size: 16px; line-height: 26px; }
  52 +
  53 + .white .highlight pre {
  54 + background: #f5f5f5;
51 } 55 }
52 } 56 }
53 57
lib/redcarpet/render/gitlab_html.rb
@@ -11,14 +11,13 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML @@ -11,14 +11,13 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
11 11
12 def block_code(code, language) 12 def block_code(code, language)
13 options = { options: {encoding: 'utf-8'} } 13 options = { options: {encoding: 'utf-8'} }
  14 + options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language)
14 15
15 - h.content_tag :div, class: h.user_color_scheme_class do  
16 - if Pygments::Lexer.find(language)  
17 - Pygments.highlight(code, options.merge(lexer: language.downcase))  
18 - else  
19 - Pygments.highlight(code, options)  
20 - end.html_safe  
21 - end 16 + <<-HTML
  17 + <div class="#{h.user_color_scheme_class}">
  18 + #{Pygments.highlight(code, options)}
  19 + </div>
  20 + HTML
22 end 21 end
23 22
24 def postprocess(full_document) 23 def postprocess(full_document)