mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:09:52 +01:00
13 lines
251 B
Ruby
13 lines
251 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TwitteredMarkdown < Redcarpet::Render::StripDown
|
|
def preprocess(text)
|
|
wrap_mentions(text)
|
|
end
|
|
|
|
def wrap_mentions(text)
|
|
text.gsub(/(^|\s)@([a-zA-Z0-9_]{1,16})/) do
|
|
"#{$1}#{$2}"
|
|
end
|
|
end
|
|
end
|