diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2021-10-03 05:17:18 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2021-10-03 05:17:18 +0000 |
commit | 09618a274bb1f7a1353ff1a8ad4d90fa3efef74c (patch) | |
tree | 92baf6ad80adc3299e17b4cdc88af1513a1eab91 /lib/redmine | |
parent | 01a8167a138a7598a4716e9c04b9d77a50de7491 (diff) | |
download | redmine-09618a274bb1f7a1353ff1a8ad4d90fa3efef74c.tar.gz redmine-09618a274bb1f7a1353ff1a8ad4d90fa3efef74c.zip |
Make hardbreaks behaviour configurable in config/configuration.yml (#32424).
git-svn-id: http://svn.redmine.org/redmine/trunk@21227 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine')
-rw-r--r-- | lib/redmine/configuration.rb | 3 | ||||
-rw-r--r-- | lib/redmine/wiki_formatting/common_mark/formatter.rb | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb index 883dc8497..aff2651bb 100644 --- a/lib/redmine/configuration.rb +++ b/lib/redmine/configuration.rb @@ -24,7 +24,8 @@ module Redmine @defaults = { 'avatar_server_url' => 'https://www.gravatar.com', 'email_delivery' => nil, - 'max_concurrent_ajax_uploads' => 2 + 'max_concurrent_ajax_uploads' => 2, + 'common_mark_enable_hardbreaks' => true } @config = nil diff --git a/lib/redmine/wiki_formatting/common_mark/formatter.rb b/lib/redmine/wiki_formatting/common_mark/formatter.rb index 6a9c95c8e..3c2f3ad09 100644 --- a/lib/redmine/wiki_formatting/common_mark/formatter.rb +++ b/lib/redmine/wiki_formatting/common_mark/formatter.rb @@ -42,11 +42,15 @@ module Redmine # https://github.com/gjtorikian/commonmarker#render-options commonmarker_render_options: [ - :HARDBREAKS, :UNSAFE - ].freeze, + ], }.freeze + if Redmine::Configuration['common_mark_enable_hardbreaks'] === true + PIPELINE_CONFIG[:commonmarker_render_options].push(:HARDBREAKS) + end + PIPELINE_CONFIG[:commonmarker_render_options].freeze + MarkdownPipeline = HTML::Pipeline.new [ MarkdownFilter, SanitizationFilter, |