Feature #32424 » configuration-setting-for-hardbreaks.patch
| app/views/settings/_general.html.erb | ||
|---|---|---|
|
<p><%= setting_select :protocol, [['HTTP', 'http'], ['HTTPS', 'https']] %></p>
|
||
|
<p><%= setting_select :text_formatting, Redmine::WikiFormatting.formats_for_select, :blank => :label_none %></p>
|
||
|
<p><%= setting_select :text_formatting, Redmine::WikiFormatting.formats_for_select, :blank => :label_none %>
|
||
|
<span id="common_mark_info" class="<%= "hidden" unless Setting.text_formatting == "common_mark" %>">
|
||
|
<em class="info">
|
||
|
<strong>Hardbreaks:</strong> <%= Redmine::Configuration['common_mark_enable_hardbreaks'] === true ? l(:label_enabled) : l(:label_disabled) %>.
|
||
|
</em>
|
||
|
<em class="info">
|
||
|
You can configure the behaviour in config/configuration.yml. Please restart the application after editing it.
|
||
|
</em>
|
||
|
</span>
|
||
|
</p>
|
||
|
<p><%= setting_check_box :cache_formatted_text %></p>
|
||
| ... | ... | |
|
<%= submit_tag l(:button_save) %>
|
||
|
<% end %>
|
||
|
<%= javascript_tag do %>
|
||
|
$('#settings_text_formatting').on('change', function(e){
|
||
|
const formatter = e.target.value;
|
||
|
const parent_block = document.getElementById("common_mark_info");
|
||
|
if (formatter == "common_mark") {
|
||
|
parent_block.classList.remove('hidden');
|
||
|
} else {
|
||
|
parent_block.classList.add('hidden');
|
||
|
}
|
||
|
});
|
||
|
<% end %>
|
||
| config/configuration.yml.example | ||
|---|---|---|
|
#avatar_server_url: https://www.gravatar.com # default
|
||
|
#avatar_server_url: https://seccdn.libravatar.org
|
||
|
# Configure CommonMark hardbreaks behaviour
|
||
|
#
|
||
|
# allowed values: true, false
|
||
|
# true: treats regular line break (\n) as hardbreaks
|
||
|
# false: switches to default common mark where two or more spaces are required
|
||
|
# common_mark_enable_hardbreaks: true
|
||
|
# specific configuration options for production environment
|
||
|
# that overrides the default ones
|
||
|
production:
|
||
| config/locales/en.yml | ||
|---|---|---|
|
label_copied_to: Copied to
|
||
|
label_copied_from: Copied from
|
||
|
label_stay_logged_in: Stay logged in
|
||
|
label_enabled: enabled
|
||
|
label_disabled: disabled
|
||
|
label_optional: optional
|
||
|
label_show_completed_versions: Show completed versions
|
||
| lib/redmine/configuration.rb | ||
|---|---|---|
|
@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
|
||
| lib/redmine/wiki_formatting/common_mark/formatter.rb | ||
|---|---|---|
|
# https://github.com/gjtorikian/commonmarker#render-options
|
||
|
commonmarker_render_options: [
|
||
|
: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,
|
||