2024-03-29 21:21:04 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
module MarkdownToHtml
|
|
|
|
|
LINK_REGEXP = %r{\[([^\]]+)\]\((https?://[^)]+)\)}
|
|
|
|
|
|
|
|
|
|
module_function
|
|
|
|
|
|
|
|
|
|
def call(text)
|
2025-06-19 12:42:44 +03:00
|
|
|
text.gsub(LINK_REGEXP) do
|
|
|
|
|
ApplicationController.helpers.link_to(Regexp.last_match(1), Regexp.last_match(2))
|
|
|
|
|
end
|
2024-03-29 21:21:04 +02:00
|
|
|
end
|
|
|
|
|
end
|