Skip to content

chore(website): replace shiki with @pierre/highlights - #344

Merged
jbergstroem merged 1 commit into
mainfrom
jbergstroem/chore/website-pierre-highlights
Oct 24, 2026
Merged

jbergstroem merged 1 commit into
mainfrom
jbergstroem/chore/website-pierre-highlights

Conversation

@jbergstroem

@jbergstroem jbergstroem commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Why

Shiki is only used at build time, to highlight about 20 snippets, yet it brings in a sizeable dependency tree and a custom TextMate grammar for the Filtron examples. @pierre/highlights is smaller and faster to build with. While checking the output I also found that the HTML minifier was collapsing whitespace inside code blocks.

What

  • Highlight the TypeScript and bash blocks with @pierre/highlights (pinned at 0.2.0) using its css-variables theme. Token colors map to the existing syntax colors through --hls-* custom properties in styles.css, so dark mode follows automatically.
  • Highlight the Filtron examples with the existing Lexer-based toHtml() from src/highlight.ts, since Pierre cannot load custom grammars. The website no longer uses the TextMate grammar; filtron.tmLanguage.json stays in @filtron/core.
  • Fail the build on an unsupported code block language.
  • Fix minifyHtml collapsing whitespace inside code. <pre> blocks and inline <code class="syntax-example"> elements lost indentation, comment alignment and the spaces between tokens (for example level>3AND...). Those blocks are now set aside while minifying.
shiki @pierre/highlights
Website build ~93-112ms ~13ms
dist/index.html 93,365 bytes 91,066 bytes
Gzipped 33,291 33,371

Highlighting happens at build time, so visitors see no size difference.

Notes

  • Written with Claude Code (Claude Sonnet 5.5) at my direction; I reviewed the result.
  • Bash output differs slightly: @filtron/core is split into @ plus a colored filtron/core, and package names are colored as variables.

Highlight TypeScript and bash blocks with @pierre/highlights using its
css-variables theme, mapped to the existing syntax colors through
--hls-* custom properties. Pierre cannot load custom grammars, so the
Filtron examples use the existing Lexer-based toHtml() instead of the
TextMate grammar. Unsupported code block languages now fail the build.

Fix the HTML minifier collapsing whitespace inside code: <pre> blocks
and inline syntax examples lost indentation, alignment and the spaces
between tokens. Set those blocks aside while minifying.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jbergstroem

Copy link
Copy Markdown
Owner Author

@coderabbitai approve

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d120f7cc-87c6-438d-8f35-160baa303277
Commits

Reviewing files that changed from the base of the PR and between dc3f934 and b57993b.

Files ignored due to path filters: 1
  • bun.lock is excluded by !**/*.lock
Files selected for processing: 3
  • website/lib/html.ts
  • website/package.json
  • website/styles.css

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The website replaces Shiki with @pierre/highlights for supported-language code blocks and uses toHtml for Filtron syntax examples. Highlighting now throws for unsupported languages and decodes the returned bytes. The CSS theme variables change from --shiki-* to --hls-*. HTML minification now saves and restores pre blocks and syntax-example code blocks.

Priority: Low

Merge Risk: Minimal · up to b5799

No concrete merge-blocking issue is established. The remaining light- and dark-mode color check can be completed as normal visual validation.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "chore(website): replace shiki with @pierre/highlights" names the main change: Shiki is replaced by @pierre/highlights in the website. The raw summary confirms the package swap in website/pa…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description follows the required Why, What, and Notes structure. It explains the motivation, implementation changes, testing context, performance and size results, agentic software us…
Full details: Title check

Explanation

The title "chore(website): replace shiki with @pierre/highlights" names the main change: Shiki is replaced by @pierre/highlights in the website. The raw summary confirms the package swap in website/package.json, the highlighting changes in website/lib/html.ts, and the CSS variable remap in website/styles.css. The title is specific, short, and uses a conventional commit prefix. It omits the minifier whitespace fix, which is expected for a title.

Full details: Description check

Explanation

The pull request description follows the required Why, What, and Notes structure. It explains the motivation, implementation changes, testing context, performance and size results, agentic software use, and relevant implementation notes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved. CodeRabbit has already approved this PR, so no new approval was submitted.

@jbergstroem
jbergstroem merged commit 180b7fb into main Oct 24, 2026
24 checks passed
@jbergstroem
jbergstroem deleted the jbergstroem/chore/website-pierre-highlights branch October 24, 2026 13:40
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.

1 participant