Skip to main content

Phase 1 — Code Block Enhancements (Test)

August 28, 20261 min read
Share

This post is for testing Phase 1. Use the new code-theme picker in the header (top-right, <> icon) to switch between GitHub Light, Vitesse Dark, Dracula, and Catppuccin. Each block below has a copy button, a language badge, and line numbers.

Line highlight {1-3}

const greeting = "hello world";
const count = greeting.length;
const upper = greeting.toUpperCase();
console.log(upper, count);

Word highlight /const

const a = 1;
let b = 2;
const c = a + b;

Combined: highlight lines 2-3 and the word return

def add(x, y):
total = x + y
return total

Plain block (still gets copy + badge + line numbers)

Terminal window
npm run dev -- --port 3001
astro build

Optional path / title

Add title="path/to/file" to the fence to show a file path in the header. The language label is shown automatically on every block.

src/components/Header.astro
const BASE = import.meta.env.BASE_URL;
function updateThemeIcon() {}
export default updateThemeIcon;

Inline code also keeps its styling.