Commit 0e524aaea1a98e5f1dff7f7370838116da5ba6f0
1 parent
ed899a2f
Exists in
master
and in
4 other branches
Added workaround for github-markup issue with rendering markdown
Showing
3 changed files
with
16 additions
and
4 deletions
Show diff stats
app/helpers/tree_helper.rb
| @@ -32,7 +32,11 @@ module TreeHelper | @@ -32,7 +32,11 @@ module TreeHelper | ||
| 32 | # | 32 | # |
| 33 | # Returns boolean | 33 | # Returns boolean |
| 34 | def markup?(filename) | 34 | def markup?(filename) |
| 35 | - filename.end_with?(*%w(.mdown .md .markdown .textile .rdoc .org .creole | ||
| 36 | - .mediawiki .rst .asciidoc .pod)) | 35 | + filename.end_with?(*%w(.textile .rdoc .org .creole |
| 36 | + .mediawiki .rst .asciidoc .pod)) | ||
| 37 | + end | ||
| 38 | + | ||
| 39 | + def gitlab_markdown?(filename) | ||
| 40 | + filename.end_with?(*%w(.mdown .md .markdown)) | ||
| 37 | end | 41 | end |
| 38 | end | 42 | end |
app/views/refs/_tree.html.haml
| @@ -43,7 +43,11 @@ | @@ -43,7 +43,11 @@ | ||
| 43 | %i.icon-file | 43 | %i.icon-file |
| 44 | = content.name | 44 | = content.name |
| 45 | .file_content.wiki | 45 | .file_content.wiki |
| 46 | - = raw GitHub::Markup.render(content.name, content.data) | 46 | + - if gitlab_markdown?(content.name) |
| 47 | + = preserve do | ||
| 48 | + = markdown(content.data) | ||
| 49 | + - else | ||
| 50 | + = raw GitHub::Markup.render(content.name, content.data) | ||
| 47 | 51 | ||
| 48 | :javascript | 52 | :javascript |
| 49 | $(function(){ | 53 | $(function(){ |
app/views/refs/_tree_file.html.haml
| @@ -9,7 +9,11 @@ | @@ -9,7 +9,11 @@ | ||
| 9 | = link_to "history", project_commits_path(@project, path: params[:path], ref: @ref), class: "btn very_small" | 9 | = link_to "history", project_commits_path(@project, path: params[:path], ref: @ref), class: "btn very_small" |
| 10 | = link_to "blame", blame_file_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small" | 10 | = link_to "blame", blame_file_project_ref_path(@project, @ref, path: params[:path]), class: "btn very_small" |
| 11 | - if file.text? | 11 | - if file.text? |
| 12 | - - if markup?(name) | 12 | + - if gitlab_markdown?(name) |
| 13 | + .file_content.wiki | ||
| 14 | + = preserve do | ||
| 15 | + = markdown(file.data) | ||
| 16 | + - elsif markup?(name) | ||
| 13 | .file_content.wiki | 17 | .file_content.wiki |
| 14 | = raw GitHub::Markup.render(name, file.data) | 18 | = raw GitHub::Markup.render(name, file.data) |
| 15 | - else | 19 | - else |