]> source.dussan.org Git - redmine.git/commitdiff
Use Commonmarker instead of Redcarpet by default when rendering Markdown attachments...
authorGo MAEDA <maeda@farend.jp>
Thu, 23 Mar 2023 04:45:19 +0000 (04:45 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 23 Mar 2023 04:45:19 +0000 (04:45 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: https://svn.redmine.org/redmine/trunk@22146 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/helpers/application_helper_test.rb

index 43f32fbc72790c898cd5d9d751902c9a7a9f05d3..3177d0eb7c0abaf2b8b154bdf694392c4b01ef65 100644 (file)
@@ -1855,10 +1855,10 @@ module ApplicationHelper
   # 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
+    if Setting.text_formatting == "markdown"
       "markdown"
+    else
+      "common_mark"
     end
   end
 
index fc0351885f281f308ad4443dd17c6a3761679ce9..ddc55dcb8e395f399926ebfa8db2ec28d9922513 100644 (file)
@@ -2229,6 +2229,20 @@ class ApplicationHelperTest < Redmine::HelperTest
     end
   end
 
+  # TODO: Remove this test when Redcarpet-based Markdown formatter is removed
+  def test_markdown_formatter
+    [
+      ['markdown', 'markdown'],
+      ['common_mark', 'common_mark'],
+      ['textile', 'common_mark'],
+      ['', 'common_mark']
+    ].each do |text_formatting, expected|
+      with_settings text_formatting: text_formatting do
+        assert_equal expected, markdown_formatter
+      end
+    end
+  end
+
   private
 
   def wiki_links_with_special_characters