Skip to content
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

TransformerMetaHighlightOptions.zeroIndex: support zero-index line numbers #841

Open
4 tasks done
olets opened this issue Nov 21, 2024 · 0 comments
Open
4 tasks done

Comments

@olets
Copy link
Contributor

olets commented Nov 21, 2024

Clear and concise description of the problem

I'm migrating/upgrading a project from eleventy-plugin-shiki-twoslash to @shikijs/markdown-it. The project makes extensive use of meta highlight notation

```lang {i…}
```

transformerMetaHighlight https://shiki.style/packages/transformers#transformermetahighlight works well as a replacement… almost.

The older tools used 0-indexed lines.

```js {1}
not highlighted
highlighted
```

transformerMetaHighlight uses 1-indexed lines

```js {1}
highlighted // unexpected
not highlighted // unexpected
```

Suggested solution

Teach transformerMetaHighlight a new option zeroIndexed.

Alternative

No response

Additional context

Easy to imagine that others will hit this pain point when upgrading, and/or prefer to use 0-indexed line numbers.

Validations

Contributes

  • If this feature request is accepted, I am willing to submit a PR to fix this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant