Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

chore(monorepo): rehype-shiki #7760

wants to merge 3 commits into from

Conversation

avivkeller
Copy link
Member

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

  1. The one TypeScript file has been converted to JavaScript, for ease of importing this package in JavaScript environments–like api-docs-tooling currently is.

@Copilot Copilot AI review requested due to automatic review settings May 19, 2025 17:11
@avivkeller avivkeller requested review from a team as code owners May 19, 2025 17:11
Copy link

vercel bot commented May 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview May 19, 2025 9:05pm

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.36%. Comparing base (663fad9) to head (9fb718d).

✅ 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@Copilot 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

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';

Copy link
Contributor

github-actions bot commented May 19, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 100 🟢 100 🟠 82 🔗
/en/about/previous-releases 🟢 100 🟢 100 🟢 100 🟠 83 🔗
/en/download 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

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.

4 participants