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

word highlighting highlights half words

Open o-az opened this issue 1 year ago • 2 comments

Using the following snippet where I'm highlighting onRecvPacket and noticed onRecvPacketProcessing is getting highlighted too:

```solidity /onRecvPacket/#g
```

CleanShot 2024-01-17 at 22 32 56@2x

Here's a stackblitz playground to see it in action: https://stackblitz.com/edit/github-j3wpz9?file=src%2Fpages%2Findex.mdx

We should discuss if this behavior is desirable or considered a bug.

cc @atomiks

o-az avatar Jan 18 '24 06:01 o-az

Workaround is to use a range to scope it:

```solidity /onRecvPacket/1#g
```

I'm not sure we should auto-implement breaking on boundaries (e.g. punctuation, spaces) or not. We could maybe add a flag to do that? Kind of like regex flags which fits with the syntax...

b for break:

```solidity /onRecvPacket/b#g
```

atomiks avatar Jan 18 '24 13:01 atomiks

I think regex is the way to go! Will do that

o-az avatar Jan 19 '24 08:01 o-az