Skip to content

Add tabs with code in different languages#232

Merged
janezd merged 1 commit into
biolab:masterfrom
janezd:code-tabs
May 16, 2026
Merged

Add tabs with code in different languages#232
janezd merged 1 commit into
biolab:masterfrom
janezd:code-tabs

Conversation

@janezd
Copy link
Copy Markdown
Contributor

@janezd janezd commented May 16, 2026

A tab defines a label and, optionally, an id; the label is used as a fallback for id. The mechanics in the background is simple: the site maintains a priority list for a user and shows the tab with the highest priority (or the first tab if no language appears in the priority list). Choosing a tab simply bumps the language's priority.

These tabs can also be used for arbitrary other content. At least technically. :)

Screen.Recording.2026-05-16.at.21.31.19.mov

Copy link
Copy Markdown

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

Adds MDX-level “code tabs” that let readers switch between multiple language variants (or other content), with the selection persisted via a user priority list in localStorage.

Changes:

  • Introduces CodeTabs / CodeTab components with a persisted preference store.
  • Exposes CodeTabs / CodeTab to MDX via MdxContent component mapping.
  • Adds global styling for tab content spacing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
styles/globals.scss Adds margin styling for non–Expressive Code content inside .code-tab.
components/MdxContent.tsx Registers CodeTabs and CodeTab as MDX components.
components/Book/CodeTabs.tsx New tab UI + localStorage-backed preference store and selection logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/Book/CodeTabs.tsx
Comment thread components/Book/CodeTabs.tsx
Comment thread components/Book/CodeTabs.tsx
Comment thread components/Book/CodeTabs.tsx
Comment thread components/Book/CodeTabs.tsx
@janezd janezd merged commit a9dd37a into biolab:master May 16, 2026
5 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.

2 participants