-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
chore(monorepo): rehype-shiki
#7760
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #7760 +/- ##
==========================================
+ Coverage 75.09% 75.36% +0.26%
==========================================
Files 98 96 -2
Lines 7914 7858 -56
Branches 196 192 -4
==========================================
- Hits 5943 5922 -21
+ Misses 1970 1935 -35
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Extracts the Shiki-based syntax highlighting logic from the website into a standalone @node-core/rehype-shiki
package to be shared (e.g., by api-docs-tooling
), converting TypeScript helpers to JavaScript and updating site imports and CI.
- Adds a new monorepo package with plugin, highlighter, language utilities, tests, and build config
- Removes inline Shiki utilities from
apps/site
and replaces them with imports from the new package - Updates GitHub Actions to include coverage and test results for all packages
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/rehype-shiki/turbo.json | Defines Turbo tasks for linting and testing the new package |
packages/rehype-shiki/src/plugin.mjs | Switches plugin to import the new highlighter and exposes named export |
packages/rehype-shiki/src/languages.mjs | Adds getLanguageDisplayName utility with JSDoc and theming |
packages/rehype-shiki/src/index.mjs | Sets up entrypoint, re-exports utilities, and default export |
packages/rehype-shiki/src/highlighter.mjs | Implements lazy-loaded Shikiji highlighter with HTML/HAST output |
packages/rehype-shiki/src/tests/languages.test.mjs | Adds tests for getLanguageDisplayName |
packages/rehype-shiki/package.json | Configures package metadata, dependencies, and scripts |
packages/rehype-shiki/eslint.config.js | Extends base ESLint config for the new package |
apps/site/util/getLanguageDisplayName.ts (deleted) | Removed inline language display helper |
apps/site/util/getHighlighter.ts (deleted) | Removed inline highlighter helper |
apps/site/package.json | Replaces direct Shiki deps with the new workspace package |
apps/site/next.mdx.plugins.mjs | Points MDX setup to use @node-core/rehype-shiki |
apps/site/components/MDX/CodeBox/index.tsx | Updates import of getLanguageDisplayName to the new package |
apps/site/components/Downloads/Release/ReleaseCodeBox.tsx | Updates import of highlightToHtml to the new package |
.github/workflows/lint-and-tests.yml | Expands Codecov globs to include all package coverage files |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)
packages/rehype-shiki/src/plugin.mjs:9
- [nitpick] The comment references 'Remark' but this is a Rehype plugin—consider updating it to 'Rehype' for clarity.
// This is what Remark will use as prefix within a <pre> className
packages/rehype-shiki/src/tests/languages.test.mjs:4
- The test imports from '../languages.js', but the actual module file is 'languages.mjs'. Update the import to '../languages.mjs' or adjust the resolution settings to match the file extension.
import { getLanguageDisplayName, LANGUAGES } from '../languages.js';
Lighthouse Results
|
This Shiki package can be imported by nodejs/api-docs-tooling#273 (
api-docs-tooling
) to provide Shiki support identical to that of the website.The files in the new package are mostly to 1:11 with the original parts in
apps/site
.Footnotes
The one TypeScript file has been converted to JavaScript, for ease of importing this package in JavaScript environments–like
api-docs-tooling
currently is. ↩