#Mantine Highlight Component, Parse as whole String not as a Sub String

4 messages · Page 1 of 1 (latest)

odd glade
#

As shown in image, The word passed in matching array was DAOMaker but Highlight component matched the word from a substring i.e a URL which shouldn't be the case here. Any idea how to fix it?

obtuse dock
odd glade
#

I see, So I have got two approaches,

  1. Is it possible to extend the default parser so add our own custom logic?
  2. I could do my own by finding it and wrapping the desired text with <Highlight /> instead of whole text in one with array being passed as the matcher. Will this be good in complexity perspective?
    Can it affect performance or can you please recommend any other good practice?
obtuse dock
#
  1. you would need to modify the library itself to do this, would mean either making a PR or maintaining a separate version of Mantine
  2. there is hardly a complexity risk, a simple parser for text usually won't take long unless you're working with truly massive amounts of text. be wary of over optimisation, it is a bad pitfall to get into, code it and see if it performs well, optimise it only when you see performance issues