markdown link

pull/493/head
Pete Matsyburka 4 months ago
parent ea24562861
commit 8f3a203994

@ -2,11 +2,12 @@
module MarkdownToHtml
LINK_REGEXP = %r{\[([^\]]+)\]\((https?://[^)]+)\)}
LINK_REPLACE = '<a href="\2">\1</a>'
module_function
def call(text)
text.gsub(LINK_REGEXP, LINK_REPLACE)
text.gsub(LINK_REGEXP) do
ApplicationController.helpers.link_to(Regexp.last_match(1), Regexp.last_match(2))
end
end
end

Loading…
Cancel
Save