rehype-pretty-code
rehype-pretty-code copied to clipboard
Overlapping multi chars highlighting
Two separate issues:
- There's no way to add "sub" highlights. Both
getStringLength
andget
should be separately highlighted.
```js /getStringLength/ /get/
const getStringLength = str => str.length;
```
- 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
.
This is also weird:
Also this one: