rehype-pretty / rehype-pretty-code

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

curly brackets with numbers inside of slashes, highlights both the characters but also lines #232

Open chrisweb opened 1 month ago

chrisweb commented 1 month ago

I'm trying to include examples of how to use rehype pretty code in my tutorial and when I want to highlight the characters you need to use to highlight a line then it does highlight those but it also highliths the lines, which is wrong

example markdown:

````md showLineNumbers{16} /{1}/#special /{3-4}/#special
```js showLineNumbers {1} {3-4}
function helloWorld() {
    // this is a comment
    let greeting = 'Hello World!'
    console.log(greeting)
}

gives me this result:

image

correct part: it highlighted the {1} and {3-4} in the inner code block using my #special ID

wrong part: it also highlighted line 1 and then also line 3 to 4

expacted result: as {1} and {3-4} are inside of slashs (/) rehype should not consider them as "highlight this line" information