Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

fix(style): remove unnecessary function, use more elegant options creation

as-op0b5314e1e0ad
diff --git a/lib/open_project/text_formatting/filters/markdown_filter.rb b/lib/open_project/text_formatting/filters/markdown_filter.rb
index 1f95dfdc593..c3b359ba6f7 100644
--- a/lib/open_project/text_formatting/filters/markdown_filter.rb
+++ b/lib/open_project/text_formatting/filters/markdown_filter.rb
@@ -31,25 +31,19 @@ module OpenProject::TextFormatting
class MarkdownFilter < HTML::Pipeline::MarkdownFilter
# Convert Markdown to HTML using CommonMarker
def call
- render_html
- end
-
- private
-
- ##
- # Render markdown to html
- def render_html
Commonmarker.to_html(text, options: commonmarker_options, plugins: commonmarker_plugins)
.tap(&:rstrip!)
end
+ private
+
##
# CommonMarker Options
# https://github.com/gjtorikian/commonmarker#options
def commonmarker_options
{
parse: { smart: false },
- extension: commonmark_extensions.map { |k| [k, true] }.to_h,
+ extension: commonmark_extensions.index_with(true),
render: {
unsafe: true,
escape: false,