-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlighting multiple specific lines offset by 1 #154
Comments
👋 - I might not accept a PR changing this, unless you can prove really is a bug and not just that you expected rehype-pretty-code's style and got ours instead. Because I probably spent some time thinking about whether we want to be 0 based of 1 based with the line settings and churn here is extremely expensive for everyone. |
Yep, confirming this is intentional to match editors which start with line 1 and gatsby-remark-vscode which we share infra with I'm not against having a config setting like |
@orta - Can you please add a little more documentation at least to the shiki-twoslash readme about the line highlighting discrepancy between And without it is line 0 based: This is due to the above mentioned difference between the
and the
That was a little confusing for me. I'm going to circumvent it at the moment by just subtracting 1 from line numbers when the I love this tool by the way! I'm very close to publishing an |
Sounds more like a bug to me, they should definitely be consistent 👍🏻 |
Hi there, been a huge fan of twoslash!
Currently experimenting with
remark-shiki-twoslash
on my Next.js +@mdx-js/mdx
v2 project and for some reason when highlighting multiple specific lines (e.g.{7,12}
) it offsets by one line. No custom configurations and no custom stylesheets (only using provided from readme), only usingrehype-raw
to fix #125.Take for example, this snippet (taken here):
Produces this (using
remark-shiki-twoslash
):Which it not correct and should produce this (using
rehype-pretty-code
):My guess it's somewhere around this line but I'll try experimenting if it's from my end of from
shiki-twoslash
's end:twoslash/packages/shiki-twoslash/src/renderers/twoslash.ts
Line 71 in d5510d7
Anything I did wrong? I'd love to make a reproducible project for this particular case if anyone's interested.
The text was updated successfully, but these errors were encountered: