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:
@@ -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>
|
||||
|
||||
@@ -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 │
|
||||
│ │ │ │ │ │
|
||||
|
||||
Reference in New Issue
Block a user