rehype-pretty / rehype-pretty-code

Beautiful code blocks for Markdown or MDX.
https://rehype-pretty.pages.dev
MIT License
1.05k stars 64 forks source link

fix: rangeless multi chars highlighting #168

Closed atomiks closed 9 months ago

atomiks commented 9 months ago

Fixes https://github.com/atomiks/rehype-pretty-code/issues/166

netlify[bot] commented 9 months ago

Deploy Preview for rehype-pretty-code ready!

Name Link
Latest commit adb952cf7a6a4f00a2d3bb3e7515c299abbcabc7
Latest deploy log https://app.netlify.com/sites/rehype-pretty-code/deploys/65ae93667e10360008e2f19c
Deploy Preview https://deploy-preview-168--rehype-pretty-code.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 9 months ago

Deploy Preview for rehype-pretty-code canceled.

Name Link
Latest commit 34827a2a6bd4e732d38f0b923234bfd19c1b83a3
Latest deploy log https://app.netlify.com/sites/rehype-pretty-code/deploys/65ae9583b3458b000875a2c4
atomiks commented 9 months ago

This one still fails: /get/ doesn't highlight all instances

/Length/1 /str/ /const/2-3 /get/

```js /Length/1 /str/ /const/2-3 /get/
const getStringLength = (str) => str.length;

const strLen = getStringLength('str');

const anotherStrLen = getStringLength('anotherStr');
atomiks commented 9 months ago

^Seems to be a separate issue regarding overlapping chars. It inherits the range from whichever node contains the textContent to be highlighted, even if the other chars aren't included. I will file a separate issue for that one.