rehype-pretty-code icon indicating copy to clipboard operation
rehype-pretty-code copied to clipboard

Overlapping multi chars highlighting

Open atomiks opened this issue 1 year ago • 1 comments

Two separate issues:

  1. There's no way to add "sub" highlights. Both getStringLength and get should be separately highlighted.
```js /getStringLength/ /get/
const getStringLength = str => str.length;
```
  1. Chars can inherit a range incorrectly, even when not encompassed by a different chars highlight (such as with the above overlapping scenario).
```js /get/1 /Length/
const getStringLength = str => str.length;
const getStringLength = str => str.length;
```

The first get is correctly highlighted, but Length incorrectly inherits the range from get because it's within the same textContent of the node (getStringLength) and also only ends up highlighting the first Length.

atomiks avatar Jan 22 '24 16:01 atomiks

This is also weird:

Screenshot 2024-05-25 at 20 08 57

Also this one:

Screenshot 2024-05-25 at 20 11 41

juji avatar May 25 '24 13:05 juji