Commit 4bd92e68 authored by Robert Speicher's avatar Robert Speicher

Return early from markdown and gfm when text is empty

parent e5d89c10
...@@ -45,6 +45,8 @@ module GitlabMarkdownHelper ...@@ -45,6 +45,8 @@ module GitlabMarkdownHelper
end end
def markdown(text, context = {}) def markdown(text, context = {})
return unless text.present?
context.merge!( context.merge!(
path: @path, path: @path,
project: @project, project: @project,
...@@ -59,6 +61,8 @@ module GitlabMarkdownHelper ...@@ -59,6 +61,8 @@ module GitlabMarkdownHelper
# TODO (rspeicher): Remove all usages of this helper and just call `markdown` # TODO (rspeicher): Remove all usages of this helper and just call `markdown`
# with a custom pipeline depending on the content being rendered # with a custom pipeline depending on the content being rendered
def gfm(text, options = {}) def gfm(text, options = {})
return unless text.present?
options.merge!( options.merge!(
path: @path, path: @path,
project: @project, project: @project,
......
%div{xmlns: "http://www.w3.org/1999/xhtml"} %div{xmlns: "http://www.w3.org/1999/xhtml"}
- if issue.description.present?
= markdown(issue.description, xhtml: true, reference_only_path: false, project: issue.project) = markdown(issue.description, xhtml: true, reference_only_path: false, project: issue.project)
%div{xmlns: "http://www.w3.org/1999/xhtml"} %div{xmlns: "http://www.w3.org/1999/xhtml"}
- if merge_request.description.present?
= markdown(merge_request.description, xhtml: true, reference_only_path: false, project: merge_request.project) = markdown(merge_request.description, xhtml: true, reference_only_path: false, project: merge_request.project)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment