Commit d6c037de authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Dont render README with markup if format is not compatible

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 03770698
......@@ -217,4 +217,8 @@ module ApplicationHelper
haml_tag :script, "$('." + html_class + "').timeago().tooltip()"
end.html_safe
end
def render_markup(file_name, file_content)
GitHub::Markup.render(file_name, file_content).html_safe
end
end
......@@ -4,7 +4,7 @@
= markdown(blob.data)
- elsif markup?(blob.name)
.file-content.wiki
= raw GitHub::Markup.render(blob.name, blob.data)
= render_markup(blob.name, blob.data)
- else
.file-content.code
- unless blob.empty?
......
......@@ -9,5 +9,5 @@
- elsif plain_text_readme?(readme.name)
%pre.clean
= readme.data
- else
= raw GitHub::Markup.render(readme.name, readme.data)
- elsif markup?(readme.name)
= render_markup(readme.name, readme.data)
......@@ -15,7 +15,7 @@
= markdown(@snippet.data)
- elsif markup?(@snippet.file_name)
.file-content.wiki
= raw GitHub::Markup.render(@snippet.file_name, @snippet.data)
= render_markup(@snippet.file_name, @snippet.data)
- else
.file-content.code
%div{class: user_color_scheme_class}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment