mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
DEV: Replace Rinku native gem with PrettyText (#31557)
We have a native dependency, Rinku, that's used only to make links in one place. We can get rid of this and use PrettyText instead. This is almost a one-for-one replacement, but PrettyText adds rel="noopener nofollow ugc" to external links, which I suspect is actually what we want. It also wraps the result in a <p> tag, which we strip out for parity with Rinku.
This commit is contained in:
@ -26,7 +26,8 @@ class TwitterApi
|
||||
end
|
||||
end
|
||||
text = link_hashtags_in link_handles_in text
|
||||
result = Rinku.auto_link(text, :all, 'target="_blank"').to_s
|
||||
result =
|
||||
PrettyText.cook(text, features_override: []).delete_prefix("<p>").delete_suffix("</p>")
|
||||
|
||||
if tweet[:includes] && media = tweet[:includes][:media]
|
||||
media.each do |m|
|
||||
|
Reference in New Issue
Block a user