Skip to content

perf(docs): highlight code with @pierre/highlights - #855

Merged
cpojer merged 4 commits into
voidzero-dev:mainfrom
kotarotaniguchi0523:claude/void-fork-shiki-replacement-az71xo
Nov 17, 2026
Merged

cpojer merged 4 commits into
voidzero-dev:mainfrom
kotarotaniguchi0523:claude/void-fork-shiki-replacement-az71xo

Conversation

@kotarotaniguchi0523

Copy link
Copy Markdown
Contributor

Highlight the code blocks of the docs with @pierre/highlights, the library @void/md already uses, instead of the Shiki highlighter of VitePress.

  • docs/.vitepress/highlight.ts is passed as markdown.highlight. It renders the markup VitePress renders with Shiki, so the theme, the copy button and code groups are unchanged.
  • The build stops on a language the highlighter does not have.
  • @pierre/highlights moves to the pnpm catalog, so the docs and @void/md use one version.

Docs build, median of 5 alternating runs (Linux, 4 cores, Node 22):

Shiki this PR
vitepress build 17.24 s 9.67 s

All 868 code blocks on the 115 pages have the same block classes, line classes and text as with Shiki. Token colors differ in places, because the two highlighters classify code differently.

Not checked: the dev server, and pages with custom components beyond the Quickstart.

Highlight the code blocks of the docs with @pierre/highlights, the
library that @void/md highlights with, through `markdown.highlight` of
VitePress. Render the markup that VitePress renders with Shiki, so that
the theme, the copy button and code groups do not change.

Stop the build on a language that the highlighter does not have, because
nothing else reports a block without colors.

Take @pierre/highlights from the catalog in the docs and in @void/md, so
that the two use one version.

The docs build takes 9.7 s where it took 17.2 s.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@kotarotaniguchi0523
kotarotaniguchi0523 requested a review from a team as a code owner November 16, 2026 13:43
cpojer
cpojer previously approved these changes Nov 17, 2026

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome!

@cpojer
cpojer merged commit 9a43af6 into voidzero-dev:main Nov 17, 2026
2 checks passed
@kotarotaniguchi0523
kotarotaniguchi0523 deleted the claude/void-fork-shiki-replacement-az71xo branch November 17, 2026 02:27
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.

2 participants