Commit 3bdf930852094169a5ea522b7b3cbf4f20a66027
1 parent
436e9646
Exists in
master
and in
4 other branches
Render markdown in snippets
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
13 additions
and
4 deletions
Show diff stats
app/views/snippets/_blob.html.haml
... | ... | @@ -8,9 +8,18 @@ |
8 | 8 | = link_to "Edit", edit_snippet_path(@snippet), class: "btn btn-tiny", title: 'Edit Snippet' |
9 | 9 | = link_to "Delete", snippet_path(@snippet), method: :delete, confirm: "Are you sure?", class: "btn btn-tiny", title: 'Delete Snippet' |
10 | 10 | = link_to "Raw", raw_snippet_path(@snippet), class: "btn btn-tiny", target: "_blank" |
11 | - .file-content.code | |
12 | - - unless @snippet.content.empty? | |
13 | - %div{class: user_color_scheme_class} | |
14 | - = raw @snippet.colorize(formatter: :gitlab) | |
11 | + - unless @snippet.content.empty? | |
12 | + - if gitlab_markdown?(@snippet.file_name) | |
13 | + .file-content.wiki | |
14 | + = preserve do | |
15 | + = markdown(@snippet.data) | |
16 | + - elsif markup?(@snippet.file_name) | |
17 | + .file-content.wiki | |
18 | + = raw GitHub::Markup.render(@snippet.file_name, @snippet.data) | |
15 | 19 | - else |
20 | + .file-content.code | |
21 | + %div{class: user_color_scheme_class} | |
22 | + = raw @snippet.colorize(formatter: :gitlab) | |
23 | + - else | |
24 | + .file-content.code | |
16 | 25 | %p.nothing_here_message Empty file | ... | ... |