Commit 465a195117138194a51487b8d1c6cd161890e88d
1 parent
dd79dba8
Exists in
master
and in
4 other branches
show rendered file if it is .markdown file
Showing
1 changed file
with
13 additions
and
7 deletions
Show diff stats
app/views/refs/_tree_file.html.haml
| @@ -9,14 +9,20 @@ | @@ -9,14 +9,20 @@ | ||
| 9 | = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "right", :target => "_blank" | 9 | = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "right", :target => "_blank" |
| 10 | = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "right", :style => "margin-right:10px;" | 10 | = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "right", :style => "margin-right:10px;" |
| 11 | - if file.text? | 11 | - if file.text? |
| 12 | - .view_file_content | ||
| 13 | - - unless file.empty? | ||
| 14 | - %div{:class => current_user.dark_scheme ? "black" : "white"} | 12 | + - if name =~ /\.(md|markdown)$/i |
| 13 | + #tree-readme-holder | ||
| 14 | + .readme | ||
| 15 | = preserve do | 15 | = preserve do |
| 16 | - = raw file.colorize(options: { linenos: 'True'}) | ||
| 17 | - - else | ||
| 18 | - %h3 | ||
| 19 | - %center Empty file | 16 | + = markdown(file.data) |
| 17 | + - else | ||
| 18 | + .view_file_content | ||
| 19 | + - unless file.empty? | ||
| 20 | + %div{:class => current_user.dark_scheme ? "black" : "white"} | ||
| 21 | + = preserve do | ||
| 22 | + = raw file.colorize(options: { linenos: 'True'}) | ||
| 23 | + - else | ||
| 24 | + %h3 | ||
| 25 | + %center Empty file | ||
| 20 | - elsif file.image? | 26 | - elsif file.image? |
| 21 | .view_file_content_image | 27 | .view_file_content_image |
| 22 | %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | 28 | %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} |