Skip to content
Snippets Groups Projects
Commit c242ca9a authored by Douwe Maan's avatar Douwe Maan
Browse files

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

parent 96c03199
No related branches found
No related tags found
No related merge requests found
Loading
@@ -207,21 +207,19 @@ module Gitlab
Loading
@@ -207,21 +207,19 @@ module Gitlab
end end
   
def escape_for_markdown(s) def escape_for_markdown(s)
s = s.gsub("*", "\\*") # No headings and lists
s = s.gsub("#", "\\#") s = s.gsub(/^#/, "\\#")
s = s.gsub(/^-/, "\\-")
# No inline code
s = s.gsub("`", "\\`") s = s.gsub("`", "\\`")
s = s.gsub(":", "\\:")
s = s.gsub("-", "\\-") # Carriage returns make me sad
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("\r", "") s = s.gsub("\r", "")
# Markdown ignores single newlines, but we need them as <br />.
s = s.gsub("\n", " \n") s = s.gsub("\n", " \n")
s s
end end
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment