Skip to content

Conversation

@avivkeller
Copy link
Member

@avivkeller avivkeller commented Nov 1, 2025

This'll make it possible to define a custom Shiki singleton for rehype-shiki to use (ie if you want to define your Shiki instance elsewhere).

It also makes Shiki a non-async rehype plugin

@avivkeller avivkeller requested a review from a team as a code owner November 1, 2025 19:38
Copilot AI review requested due to automatic review settings November 1, 2025 19:38
@vercel
Copy link

vercel bot commented Nov 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Nov 2, 2025 6:13pm

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.71%. Comparing base (e753dd2) to head (2949616).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/rehype-shiki/src/index.mjs 0.00% 2 Missing ⚠️
packages/rehype-shiki/src/plugin.mjs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8320      +/-   ##
==========================================
+ Coverage   76.61%   76.71%   +0.09%     
==========================================
  Files         117      118       +1     
  Lines        9751     9805      +54     
  Branches      328      335       +7     
==========================================
+ Hits         7471     7522      +51     
- Misses       2278     2281       +3     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the rehype-shiki plugin to support an optional pre-initialized highlighter instance, transitioning from a traditional function declaration to an arrow function pattern while improving type documentation.

Key changes:

  • Refactored the plugin to accept an optional highlighter parameter and use arrow function syntax
  • Fixed JSDoc syntax errors by converting @param to @property for type definition fields
  • Added comprehensive type definition for SyntaxHighlighter in the highlighter module

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/rehype-shiki/src/plugin.mjs Refactored to arrow function syntax and updated to accept optional highlighter parameter
packages/rehype-shiki/src/index.mjs Fixed JSDoc syntax by converting @param to @property for HighlighterOptions fields
packages/rehype-shiki/src/highlighter.mjs Added SyntaxHighlighter typedef and return type documentation
packages/rehype-shiki/package.json Bumped version from 1.2.0 to 1.3.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@avivkeller avivkeller force-pushed the feat/shiki/highlighter branch from b7c7368 to 875b379 Compare November 1, 2025 19:51
@avivkeller avivkeller changed the title feat(shiki): allow custom highlighters feat(shiki): allow custom highlighters, avoid async rehype Nov 1, 2025
@avivkeller
Copy link
Member Author

Deployment works locally, cc @nodejs/web-infra

@avivkeller
Copy link
Member Author

PTAL @nodejs/nodejs-website

@ovflowd ovflowd added this pull request to the merge queue Nov 2, 2025
Merged via the queue into main with commit 5a1d0c8 Nov 2, 2025
12 checks passed
@ovflowd ovflowd deleted the feat/shiki/highlighter branch November 2, 2025 19:55
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

Successfully merging this pull request may close these issues.

3 participants