how to highlight search results

前端 未结 3 2084
野的像风
野的像风 2020-12-21 01:55

hello i have a search function in that i will search a db for keywords. i would like to highlight the keywords and found a second function that i would like to implement int

3条回答
  •  盖世英雄少女心
    2020-12-21 02:30

    I would not use the SQL method. As time goes on, and you have more and more highlighting rules, that will become unmanageable. Also trickier to handle the cases where you need to highlight foo differently to foobar, but one contains the other.

    Separate your data handling from your formatting.

提交回复
热议问题