From b897b13ba8212b9ede6fa207483bcb69c8ec6fa9 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Wed, 11 Aug 2021 21:52:04 +0000 Subject: Render markdown attachments using markdown or common_mark based on the text formatting setting (#32424). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Marius BÄ‚LTEANU and Martin Cizek. git-svn-id: http://svn.redmine.org/redmine/trunk@21165 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 10 ++++++++++ app/helpers/attachments_helper.rb | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0db895441..0618b614d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index b59f9446f..f8f90df87 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -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 -- cgit v1.2.3