#1313·shiki

Feature proposal: Add filtering to `transformerRemoveComments`

Author: sq11yCreated Aug 31, 2026Updated Aug 31, 2026

Clear and concise description of the problem

I wish to have the ability to decide which comments to remove, like for example to only remove prettier-ignore comments.

I intend to submit a PR for this.

Suggested solution

A filter function option which accepts the token.content (or the token directly?) as an argument, for the users to implement their own logic for when it should or shouldn't be included.

I have already made a fork with this suggestion, so if it's easier, do take a look: https://github.com/sq11y/shiki/commit/11d2a2cc3f517d01d4a7bb59c55a537e6515b087

Alternative

No response

Additional context

No response

Validations