markdown link

This commit is contained in:
Pete Matsyburka committed 2025-06-19 12:45:44 +03:00
1 parent ea24562861
commit 8f3a203994
1 file changed
+3 -2
+3 -2
View File
@@ -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