mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 00:20:54 +08:00
FIX: highlight in yellow, not blue
FEATURE: highlight in title
This commit is contained in:
@ -30,13 +30,7 @@ class Search
|
||||
terms = @term.split(/\s+/)
|
||||
blurb = TextHelper.excerpt(cooked, terms.first, radius: 100)
|
||||
blurb = TextHelper.truncate(cooked, length: 200) if blurb.blank?
|
||||
blurb = Sanitize.clean(blurb)
|
||||
|
||||
terms.each do |term|
|
||||
blurb.gsub!(Regexp.new("(#{Regexp.escape(term)})", Regexp::IGNORECASE), "<span class='highlighted'>\\1</span>")
|
||||
end
|
||||
|
||||
blurb
|
||||
Sanitize.clean(blurb)
|
||||
end
|
||||
|
||||
def add(object)
|
||||
|
Reference in New Issue
Block a user