Commit 17bd6b13bcc9eb43c9fe972a73446652d72fca13
Exists in
master
and in
4 other branches
Merge pull request #821 from oreofish/showmarkdown
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 | 9 | = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path]), :class => "right", :target => "_blank" |
10 | 10 | = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref), :class => "right", :style => "margin-right:10px;" |
11 | 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 | 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 | 26 | - elsif file.image? |
21 | 27 | .view_file_content_image |
22 | 28 | %img{ :src => "data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"} | ... | ... |