summaryrefslogtreecommitdiffstats
path: root/lib/redmine/wiki_formatting
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2024-11-03 18:34:06 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2024-11-03 18:34:06 +0000
commit39401e4b956ec8319a36ce7c152fbccd7393110f (patch)
treee2887cced3dead86a86187d29ece2deb73aa9756 /lib/redmine/wiki_formatting
parent5802c68ffec22bf01bc866bd36ea7d02768b29ad (diff)
downloadredmine-39401e4b956ec8319a36ce7c152fbccd7393110f.tar.gz
redmine-39401e4b956ec8319a36ce7c152fbccd7393110f.zip
Reverts r23190-r23187 because the CI build fails with error "ERROR: Failed to build gem native extension" (#40197).
git-svn-id: https://svn.redmine.org/redmine/trunk@23197 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting')
-rw-r--r--lib/redmine/wiki_formatting/common_mark/formatter.rb36
-rw-r--r--lib/redmine/wiki_formatting/common_mark/markdown_filter.rb18
2 files changed, 25 insertions, 29 deletions
diff --git a/lib/redmine/wiki_formatting/common_mark/formatter.rb b/lib/redmine/wiki_formatting/common_mark/formatter.rb
index 2eee19fa3..42cae4f3a 100644
--- a/lib/redmine/wiki_formatting/common_mark/formatter.rb
+++ b/lib/redmine/wiki_formatting/common_mark/formatter.rb
@@ -26,28 +26,32 @@ module Redmine
# configuration of the rendering pipeline
PIPELINE_CONFIG = {
# https://github.com/gjtorikian/commonmarker#extension-options
- commonmarker_extensions: {
- table: true,
- strikethrough: true,
- tagfilter: true,
- autolink: true,
- footnotes: true,
- }.freeze,
+ commonmarker_extensions: [
+ :table,
+ :strikethrough,
+ :tagfilter,
+ :autolink
+ ].freeze,
# https://github.com/gjtorikian/commonmarker#parse-options
- commonmarker_parse_options: {
- }.freeze,
+ commonmarker_parse_options: [
+ :FOOTNOTES,
+ :STRIKETHROUGH_DOUBLE_TILDE,
+ :UNSAFE,
+ :VALIDATE_UTF8
+ ].freeze,
# https://github.com/gjtorikian/commonmarker#render-options
- commonmarker_render_options: {
- unsafe: true,
- hardbreaks: Redmine::Configuration['common_mark_enable_hardbreaks'] == true ? true : false,
- }.freeze,
- commonmarker_plugins: {
- syntax_highlighter: nil
- }.freeze,
+ commonmarker_render_options: [
+ :UNSAFE
+ ],
}.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,
diff --git a/lib/redmine/wiki_formatting/common_mark/markdown_filter.rb b/lib/redmine/wiki_formatting/common_mark/markdown_filter.rb
index 0b7f52ea3..916c8883c 100644
--- a/lib/redmine/wiki_formatting/common_mark/markdown_filter.rb
+++ b/lib/redmine/wiki_formatting/common_mark/markdown_filter.rb
@@ -32,12 +32,8 @@ module Redmine
end
def call
- html = Commonmarker.to_html(@text, options: {
- extension: extensions,
- render: render_options,
- parse: parse_options
- }, plugins: plugins )
-
+ doc = CommonMarker.render_doc(@text, parse_options, extensions)
+ html = doc.to_html render_options, extensions
html.rstrip!
html
end
@@ -45,19 +41,15 @@ module Redmine
private
def extensions
- context.fetch :commonmarker_extensions, {}
+ context.fetch :commonmarker_extensions, []
end
def parse_options
- context.fetch :commonmarker_parse_options, {}
+ context.fetch :commonmarker_parse_options, :DEFAULT
end
def render_options
- context.fetch :commonmarker_render_options, {}
- end
-
- def plugins
- context.fetch :commonmarker_plugins, {}
+ context.fetch :commonmarker_render_options, :DEFAULT
end
end
end