Commit 89ab7e79adb76752f46ced38e74e396b020e84ff
1 parent
3fafac3e
Exists in
spb-stable
and in
3 other branches
Highlight code search results
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/views/search/results/_blob.html.haml
| ... | ... | @@ -6,5 +6,4 @@ |
| 6 | 6 | %strong |
| 7 | 7 | = blob.filename |
| 8 | 8 | .file-content.code.term |
| 9 | - %div{class: user_color_scheme_class} | |
| 10 | - = raw blob.colorize( formatter: :gitlab, options: { first_line_number: blob.startline } ) | |
| 9 | + = render 'shared/file_hljs', blob: blob, first_line_number: blob.startline | ... | ... |
app/views/shared/_file_hljs.html.haml
| 1 | 1 | %div.highlighted-data{class: user_color_scheme_class} |
| 2 | 2 | .line-numbers |
| 3 | 3 | - blob.data.lines.size.times do |index| |
| 4 | - - i = index + 1 | |
| 4 | + - offset = defined?(first_line_number) ? first_line_number : 1 | |
| 5 | + - i = index + offset | |
| 5 | 6 | = link_to "#L#{i}", id: "L#{i}", rel: "#L#{i}" do |
| 6 | 7 | %i.icon-link |
| 7 | 8 | = i | ... | ... |