GithubHelp home page GithubHelp logo

Comments (4)

Geksanit avatar Geksanit commented on July 21, 2024

expected result is the same as with one space
image

from highlight-words.

tricinel avatar tricinel commented on July 21, 2024

Hi @Geksanit! Nice catch! I'm not sure though if it should be the expected result. I think prepping the query should be in the hands of the consumer, otherwise we might end up stripping things we're not supposed to from the query.

You raise a good question though...what should the expected result then be? I'm not sure, so I'll have a think.

from highlight-words.

Geksanit avatar Geksanit commented on July 21, 2024

Hi @tricinel Perhaps the query should be an array of string?

from highlight-words.

tricinel avatar tricinel commented on July 21, 2024

Definitely not! I don't see how that would help. I think I have it sorted though.

  1. If the query contains more than one space in the middle, we will strip it. So over the and over the with more than 2 spaces in between all are equivalent to searching for (over|the).
  2. If the consumer specifically wants the double space, they can pass matchExactly: true as before. We don't strip multiple spaces then.
  3. If the consumer wants to highlight individual words and however many spaces, then they can pass a regexp directly in the query. Something like /(\w+)|\s{2,}/ - which will highlight all words and at least two consecutive spaces.

I'm not sure if this is a breaking change. If anything, it was a bug before.

from highlight-words.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.