From 52fde57df7ce20cb6a5b292ce4b392308061986e Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Fri, 17 Apr 2026 10:04:03 +0530 Subject: [PATCH] feat(docs): align fenced code padding on blog and doc pages - Set --ifm-pre-padding to 1.25rem for consistent code block inset - Restore horizontal padding for line-numbered Docusaurus blocks - Scope pre/code resets via article .markdown so blog chip styles no longer strip CodeBlock inner padding on Prism fences Made-with: Cursor --- docs/my-website/src/css/custom.css | 41 +++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/docs/my-website/src/css/custom.css b/docs/my-website/src/css/custom.css index b036604cf1..895603bb7e 100644 --- a/docs/my-website/src/css/custom.css +++ b/docs/my-website/src/css/custom.css @@ -27,6 +27,8 @@ --ifm-font-size-base: 15px; --ifm-line-height-base: 1.65; --ifm-border-radius: 6px; + /* Code fences: slightly more inset than Infima default (1rem), esp. next to bash left accent */ + --ifm-pre-padding: 1.25rem; /* Wider reading column — reduces excessive whitespace on large monitors */ --ifm-container-width: 1380px; --ifm-container-width-xl: 1560px; @@ -309,6 +311,38 @@ li.tabs__item--active { line-height: 1.6; } +/* Docusaurus line-number mode uses vertical-only padding on the inner wrapper; restore horizontal inset */ +.theme-code-block span[class*='codeLineContent'] { + padding-left: var(--ifm-pre-padding); +} + +/* Doc + blog: both render under `article > .markdown`. Blog prose `.markdown code` and + `pre:not(.prism-code) code` were zeroing inner padding on fenced blocks — match Infima/CodeBlock. */ +article .markdown pre:not(.prism-code) code { + background: transparent; + border: none; + padding: 0; + color: inherit; +} + +article .markdown pre.prism-code code[class*='codeBlockLinesWithNumbering'] { + padding: var(--ifm-pre-padding) 0 !important; + font-size: var(--ifm-code-font-size) !important; + line-height: var(--ifm-pre-line-height) !important; + background: transparent !important; + border: none !important; + color: inherit !important; +} + +article .markdown pre.prism-code code[class*='codeBlockLines']:not([class*='codeBlockLinesWithNumbering']) { + padding: var(--ifm-pre-padding) !important; + font-size: var(--ifm-code-font-size) !important; + line-height: var(--ifm-pre-line-height) !important; + background: transparent !important; + border: none !important; + color: inherit !important; +} + [data-theme='dark'] .prism-code { border: 1px solid #21262d; } @@ -881,13 +915,6 @@ video { box-shadow: 0 1px 3px rgba(0,0,0,0.06); } -.blog-wrapper article .markdown pre code { - background: transparent; - border: none; - padding: 0; - color: inherit; -} - /* Hide tags section at bottom of blog posts */ .blog-wrapper footer [class*='blogPostTags'], .blog-wrapper footer [class*='tags'] {