1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 11:37:14 +00:00

Render markdown attachments using markdown or common_mark based on the text formatting setting (#32424).

Patch by Marius BĂLTEANU and Martin Cizek.

git-svn-id: http://svn.redmine.org/redmine/trunk@21165 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu 2021-08-11 21:52:04 +00:00
parent c1b3804555
commit b897b13ba8
3 changed files with 12 additions and 2 deletions

View File

@ -1837,6 +1837,16 @@ module ApplicationHelper
)
end
# Returns the markdown formatter: markdown or common_mark
# ToDo: Remove this when markdown will be removed
def markdown_formatter
if Setting.text_formatting == "common_mark"
"common_mark"
else
"markdown"
end
end
private
def wiki_helper

View File

@ -92,7 +92,7 @@ module AttachmentsHelper
def render_file_content(attachment, content)
if attachment.is_markdown?
render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => content}
render :partial => 'common/markup', :locals => {:markup_text_formatting => markdown_formatter, :markup_text => content}
elsif attachment.is_textile?
render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => content}
else

View File

@ -13,7 +13,7 @@
<% elsif Redmine::MimeType.of(@path) == 'text/x-textile' %>
<%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => @content} %>
<% elsif Redmine::MimeType.of(@path) == 'text/markdown' %>
<%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => @content} %>
<%= render :partial => 'common/markup', :locals => {:markup_text_formatting => markdown_formatter, :markup_text => @content} %>
<% elsif @content %>
<%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
<% else %>