Skip to content

Conversation

@ryangjchandler
Copy link
Collaborator

@ryangjchandler ryangjchandler commented Aug 25, 2025

You can now apply decorations to a specific line, which right now means adding classes to a line of your choosing.

(new Phiki)
    ->codeToHtml(...)
    ->decoration(new LineDecoration(0, new ClassList(['my-class']))

The first line (0-indexed lines) will now have the my-class class added to it.

I would like to add support for Shiki's character decorations too in the future, but there's quite a bit of logic involved with that since they can split tokens into multiple smaller tokens, creating wrapper elements, etc.

@ryangjchandler ryangjchandler added the enhancement New feature or request label Aug 25, 2025
@ryangjchandler ryangjchandler merged commit e857764 into 2.x Aug 25, 2025
5 checks passed
@ryangjchandler ryangjchandler deleted the decorations-api branch August 25, 2025 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants