Skip to content

feat(web): syntax highlighting for blog MDX + SDK showcase (SQLR-44)#121

Merged
joaoh82 merged 2 commits intomainfrom
feat/blog-syntax-highlight-sqlr-44
May 10, 2026
Merged

feat(web): syntax highlighting for blog MDX + SDK showcase (SQLR-44)#121
joaoh82 merged 2 commits intomainfrom
feat/blog-syntax-highlight-sqlr-44

Conversation

@joaoh82
Copy link
Copy Markdown
Owner

@joaoh82 joaoh82 commented May 10, 2026

Summary

  • Wire rehype-pretty-code + Shiki into the blog MDX renderer so fenced code blocks tokenize at build time. Inline `code` keeps its existing chip styling; fences without a language fall back to plaintext so a missing tag never breaks the build.
  • Pre-render the six landing-page SDK snippets with the same Shiki pipeline. The SDK showcase now splits into a server component that calls highlightCode() and a small client wrapper that owns tab state.
  • Use createCssVariablesTheme so Shiki emits inline styles like color: var(--shiki-token-keyword). The mapping from --shiki-* to the existing palette tokens (--color-kw, --color-str, --color-num, …) lives in globals.css (.blog-article-body pre and .code-body) — adjust colors there, not in components.
  • Shared theme + helper centralized in web/src/lib/highlight.ts; README updated to point future readers at the right files.

Test plan

  • npm run typecheck — clean
  • npm run lint — clean
  • npm run build — 14.79s wall (baseline 15.88s, no regression). Static HTML contains shiki token spans on /blog/<slug> pages and the active rust snippet on /. The other five SDK tabs' highlighted HTML is in the RSC payload, so client-side tab switching is instant.
  • Home page client bundle: 5.16 kB → 3.98 kB (raw snippet strings now live server-side).
  • Visual smoke check on Vercel preview

Out of scope

Line numbers, copy buttons, language label chips. Tracked separately as a UX follow-up.

🤖 Generated with Claude Code

joaoh82 and others added 2 commits May 10, 2026 09:53
Wire rehype-pretty-code + Shiki into the MDXRemote pipeline in
web/src/components/blog-mdx.tsx and map Shiki's --shiki-token-* CSS
variables onto the blog's existing palette tokens in globals.css so
themes stay coherent. Inline code keeps its chip styling
(bypassInlineCode) and unlanguaged fences fall back to plaintext.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-render the six SDK snippets with shiki at build time and ship the
resulting HTML to the existing client-side tab switcher. The shiki
theme (createCssVariablesTheme) and helper move to a shared
src/lib/highlight.ts so the blog MDX and the landing page reuse the
same --shiki-token-* → palette mapping. The .code-body rule in
globals.css declares the same shiki var mapping the blog does.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 10, 2026

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

Project Deployment Actions Updated (UTC)
rust-sqlite Ready Ready Preview, Comment May 10, 2026 8:03am

Request Review

@joaoh82 joaoh82 merged commit 17eac04 into main May 10, 2026
18 checks passed
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