Commit c242ca9a authored by Douwe Maan's avatar Douwe Maan

Get imported links to render correctly by not escaping all special chars.

parent 96c03199
......@@ -207,21 +207,19 @@ module Gitlab
end
def escape_for_markdown(s)
s = s.gsub("*", "\\*")
s = s.gsub("#", "\\#")
# No headings and lists
s = s.gsub(/^#/, "\\#")
s = s.gsub(/^-/, "\\-")
# No inline code
s = s.gsub("`", "\\`")
s = s.gsub(":", "\\:")
s = s.gsub("-", "\\-")
s = s.gsub("+", "\\+")
s = s.gsub("_", "\\_")
s = s.gsub("(", "\\(")
s = s.gsub(")", "\\)")
s = s.gsub("[", "\\[")
s = s.gsub("]", "\\]")
s = s.gsub("<", "\\<")
s = s.gsub(">", "\\>")
# Carriage returns make me sad
s = s.gsub("\r", "")
# Markdown ignores single newlines, but we need them as <br />.
s = s.gsub("\n", " \n")
s
end
......
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