diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index 3ae6d32210e83aaecdf7d6b774ead00bd452de2a..9afb5974858df16ec9a0ccf46abea27c30439ad6 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -56,7 +56,7 @@ class Dispatcher new SearchAutocomplete(path, project_id, project_ref) initHighlight: -> - $('pre code').each (i, e) -> + $('.highlight pre code').each (i, e) -> hljs.highlightBlock(e) $(e).html($.map($(e).html().split("\n"), (line, i) -> "
" + line + "
" diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 69e9e67f71216b07fc338281736f84aff2646fd8..d200d962cae1a9939048954a285cdea817ce2915 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -94,6 +94,9 @@ class Notes if @isNewNote(note) @note_ids.push(note.id) $('ul.main-notes-list').append(note.html) + code = "#note_" + note.id + " .highlight pre code" + $(code).each (i, e) -> + hljs.highlightBlock(e) ### @@ -253,6 +256,9 @@ class Notes updateNote: (xhr, note, status) => note_li = $("#note_" + note.id) note_li.replaceWith(note.html) + code = "#note_" + note.id + " .highlight pre code" + $(code).each (i, e) -> + hljs.highlightBlock(e) ### Called in response to clicking the edit note link diff --git a/app/assets/stylesheets/generic/highlight.scss b/app/assets/stylesheets/generic/highlight.scss index 7614d2083fc48703a02ba1e16fcea7963a871638..f8316caca9700ec144f8fd03c04c146e2f63bd15 100644 --- a/app/assets/stylesheets/generic/highlight.scss +++ b/app/assets/stylesheets/generic/highlight.scss @@ -6,6 +6,7 @@ table-layout: fixed; pre { + padding: 10px; border: none; border-radius: 0; font-family: $monospace_font; @@ -57,10 +58,6 @@ pre { white-space: pre; word-wrap: normal; - - .line { - padding: 0 10px; - } } } } diff --git a/app/assets/stylesheets/main/mixins.scss b/app/assets/stylesheets/main/mixins.scss index e637b645b5527e570819f902da9ef0789b2b3cbf..0e76808d3e82e297e9d79abd50619a72290262f2 100644 --- a/app/assets/stylesheets/main/mixins.scss +++ b/app/assets/stylesheets/main/mixins.scss @@ -128,7 +128,7 @@ } } - code { + p > code { font-size: inherit; font-weight: inherit; color: #555; diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss index 1ae0e161aa245c40a92b9ecc882ac379007aa0e8..be62341ed6548b66c00ee29708d0f6665266c330 100644 --- a/app/assets/stylesheets/sections/notes.scss +++ b/app/assets/stylesheets/sections/notes.scss @@ -92,10 +92,6 @@ ul.notes { .note-body { @include md-typography; margin-left: 45px; - - .highlight { - @include border-radius(4px); - } } .note-header { padding-bottom: 5px; diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index b3e8ed2ade58efc18a64e0ba9a53c2205e099473..6da0c1d6f96bc356f4be803eeca52e5bb36fdacf 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -23,9 +23,7 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
-
-      #{code}
-    
+
#{code}
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index daceb214be7209c13c3a11c9c89688e942947172..427ac0f8083cbd38c5b592036022fdc5d1151393 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -378,7 +378,7 @@ describe GitlabMarkdownHelper do it "should leave code blocks untouched" do helper.stub(:user_color_scheme_class).and_return(:white) - target_html = "\n
\n
\n
\n      some code from $#{snippet.id}\nhere too\n\n    
\n
\n
\n\n" + target_html = "\n
\n
\n
some code from $#{snippet.id}\nhere too\n
\n
\n
\n\n" helper.markdown("\n some code from $#{snippet.id}\n here too\n").should == target_html helper.markdown("\n```\nsome code from $#{snippet.id}\nhere too\n```\n").should == target_html