question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ignore soft hyphens, word breaks & zero-width stuff

See original GitHub issue

Please add support for highlighting content that includes a soft hyphen (&shy;), a word break opportunity HTML tag (<wbr>) or a zero-width space (&#8203;).

In this demo, I added a &shy;, <wbr> and &#8203; at various locations inside of the word “Lorem”. And when using mark.js to highlight “Lorem”, only two out of the five results are marked. Performing a browser search reveals all five matches.

I believe this applies to all browsers, but I did test and got the same results in the latest versions of Chrome & Firefox (Windows 10) with mark.js version (8.1.1).

References:

I also found that zero-width non-joiner (&#8204;) and zero-width joiner (&#8205;) also produces the same result. Odd that they aren’t discussed as much… I guess because these last two are joiners don’t appear work with css hyphens - demo modified from this page.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mottiecommented, Sep 5, 2016

Ok, I think I’m going to go with ignoreJoiners because my other idea of using killWhitey didn’t seem too appropriate either.

I’ve started working on tests, and I have an odd question - why does the across elements filter file not have any elements to span across?

1reaction
Mottiecommented, Sep 5, 2016

They don’t seem to be really known.

I’m all about weird stuff. Like me! 😀

If this doesn’t require a lot of code we can support this.

I’ve already got something working. The regular expression starts to look really ugly, so I think disabling this option by default would be preferred.

So what would you want to name this option? I started out with ignoreWhitespace but that isn’t accurate enough. It only applies to soft hyphens and some zero-width characters.

Read more comments on GitHub >

github_iconTop Results From Across the Web

On “word-break,” Soft Hyphens, and Zero-Width Spaces
Word breaks and hyphenation are sometimes a problem when it comes to little available space but long words: The longer the word and...
Read more >
Control hyphenation - Microsoft Support
How to automatically hyphenate your Word document. ... You can have Word hyphenate your text automatically as you type your text, or later,...
Read more >
hyphens | CSS-Tricks
Words are never hyphenated at line breaks, even if characters inside the ... inject soft hyphens and zero-width spaces into your content.
Read more >
css - How to prevent long words from breaking my div?
Soft hyphen. You can tell browsers where to split long words by inserting soft hyphen ( ­ ): averyvery­longword. may be rendered as....
Read more >
Deep Dive into Text Wrapping and Word Breaking
Normally, text flows to the next line at “soft wrap opportunities” ... expect text to break naturally, like between words or after a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found