fix: replace rehype-pretty-code with react-syntax-highlighter for SSR compatibility

This commit is contained in:
2026-04-22 00:14:29 +02:00
parent fb3718cf12
commit 18fdbf1ce5
4 changed files with 66 additions and 122 deletions

View File

@@ -282,65 +282,12 @@ a {
}
}
/* ── Syntax Highlighting (rehype-pretty-code / Shiki) ─────────────────── */
/* Code block wrapper */
figure[data-rehype-pretty-code-figure] {
margin: 1.5rem 0;
border-radius: 0.75rem;
overflow: hidden;
border: 1px solid var(--line);
}
/* Title bar (e.g. ```ts filename.ts) */
[data-rehype-pretty-code-title] {
background: var(--surface-strong);
color: var(--sea-ink-soft);
font-size: 0.75rem;
font-family: 'Manrope', sans-serif;
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--line);
letter-spacing: 0.04em;
}
/* The <pre> block */
pre[data-theme] {
background: var(--surface) !important;
padding: 1.25rem 1.5rem;
overflow-x: auto;
font-size: 0.875rem;
line-height: 1.7;
}
/* Inline code */
:not(pre) > code[data-theme] {
/* ── Inline code ──────────────────────────────────────────────────────── */
.prose code:not([class]) {
background: var(--chip-bg);
border: 1px solid var(--chip-line);
border-radius: 0.3rem;
padding: 0.15em 0.45em;
font-size: 0.85em;
}
/* Highlighted line */
span[data-highlighted-line] {
background: color-mix(in oklch, var(--lagoon) 12%, transparent);
border-left: 2px solid var(--lagoon);
padding-left: calc(1.5rem - 2px);
margin-left: -1.5rem;
display: block;
}
/* Line numbers */
code[data-line-numbers] {
counter-reset: line;
}
code[data-line-numbers] > [data-line]::before {
counter-increment: line;
content: counter(line);
display: inline-block;
width: 1rem;
margin-right: 1.5rem;
text-align: right;
color: var(--sea-ink-soft);
opacity: 0.4;
font-family: ui-monospace, monospace;
}