Skip to content

Commit

Permalink
Remove <b> from search result
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Jul 17, 2020
1 parent a9867e3 commit d4be5a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ def render_list_items(list = [])
end

def highlight(text, terms: [])
text = text.gsub(/<.+?>/, "")
text = escape_once(text)
terms.each do |term|
text = text.gsub(term, "<em>" + term + "</em>").gsub(/\\n|\\r/, "")
text = text.gsub(term, "<b>" + term + "</b>").gsub(/\\n|\\r/, "")
end
raw text
end
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/front/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
color: #888;
font-size: 15px;
word-break: break-all;
em {
b {
color: var(--red);
}
}
Expand Down

0 comments on commit d4be5a2

Please sign in to comment.