website: fix code block line number alignment when lineHeight prop differs from default

The CodeBlock component passes lineHeight to the parent <div> but the <code>
element was inheriting line-height: 1.85 from the Prism CSS rule
(code[class*="language-"]) which has higher specificity than inheritance.
This caused line numbers and code lines to drift apart when a custom
lineHeight was passed (e.g. the architecture diagram at 1.5).

Fix: pass lineHeight as inline style on <code> so it overrides the CSS rule.
Also reduce diagram block line-height from 1.5 to 1.3 for tighter rendering.
This commit is contained in:
Tommy D. Rossi
2026-02-21 16:52:35 +01:00
parent ee948930fe
commit ad2ac529d4
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -405,7 +405,7 @@ export function CodeBlock({ children, lang = "jsx", lineHeight = "1.85" }: { chi
<code
ref={codeRef}
className={`language-${lang}`}
style={{ whiteSpace: "pre", background: "none", padding: 0 }}
style={{ whiteSpace: "pre", background: "none", padding: 0, lineHeight }}
>
{children}
</code>
+1 -1
View File
@@ -162,7 +162,7 @@ export default function IndexPage() {
no flags, no special setup.
</P>
<CodeBlock lang="bash" lineHeight="1.5">{dedent`
<CodeBlock lang="bash" lineHeight="1.3">{dedent`
┌─────────────────────┐ ┌──────────────────────┐ ┌─────────────────┐
│ BROWSER │ │ LOCALHOST │ │ CLIENT │
│ │ │ │ │ │