Project

General

Profile

Feature #32424 » 0011-Render-markdown-attachments-using-markdown-or-common.patch

Marius BĂLTEANU, 2021-07-04 12:21

View differences:

app/helpers/application_helper.rb
1825 1825
    )
1826 1826
  end
1827 1827

  
1828
  # Returns the markdown formatter: markdown or common_mark
1829
  # ToDo: Remove this when markdown will be removed
1830
  def markdown_formatter
1831
    if Setting.text_formatting == "common_mark"
1832
      "common_mark"
1833
    else
1834
      "markdown"
1835
    end
1836
  end
1837

  
1828 1838
  private
1829 1839

  
1830 1840
  def wiki_helper
app/helpers/attachments_helper.rb
92 92

  
93 93
  def render_file_content(attachment, content)
94 94
    if attachment.is_markdown?
95
      render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => content}
95
      render :partial => 'common/markup', :locals => {:markup_text_formatting => markdown_formatter, :markup_text => content}
96 96
    elsif attachment.is_textile?
97 97
      render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => content}
98 98
    else
app/views/repositories/entry.html.erb
13 13
<% elsif Redmine::MimeType.of(@path) == 'text/x-textile' %>
14 14
  <%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'textile', :markup_text => @content} %>
15 15
<% elsif Redmine::MimeType.of(@path) == 'text/markdown' %>
16
  <%= render :partial => 'common/markup', :locals => {:markup_text_formatting => 'markdown', :markup_text => @content} %>
16
  <%= render :partial => 'common/markup', :locals => {:markup_text_formatting => markdown_formatter, :markup_text => @content} %>
17 17
<% elsif @content %>
18 18
  <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
19 19
<% else %>
(10-10/26)