Compare commits

..

1 Commits

Author SHA1 Message Date
Brett Jephson 6eae39cb10 Fade collapsed code blocks on published sites (RND-13930)
The collapsed fade masked the full-height <code>, so for snippets of 20+ lines
it ended below the clip and never showed. Base the mask stops on the visible
line count instead, matching the editor's 55% → 100% fade without fading the
block's border.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 16:42:00 +00:00
5 changed files with 12 additions and 12 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Fade the bottom of collapsed code blocks so readers can tell there is more code, matching the editor.
@@ -1,5 +0,0 @@
---
"@gitbook/react-openapi": patch
---
Copy the current spec's server in OpenAPI endpoint URLs instead of a server kept from a previously visited page.
@@ -180,7 +180,11 @@ function CodeBlockExpandable(props: {
<div
className={tcls(
!isExpanded
? '[&_pre]:h-[calc(2rem+var(--line-count)*var(--line-height))] [&_pre]:overflow-y-hidden'
? [
'[&_pre]:h-[calc(2rem+var(--line-count)*var(--line-height))] [&_pre]:overflow-y-hidden',
// Mask the code rather than the pre to keep its border, with stops on the visible lines.
'[&_code]:mask-b-from-[calc((var(--line-count)+1)*var(--line-height)*0.55)] [&_code]:mask-b-to-[calc((var(--line-count)+1)*var(--line-height))]',
]
: ''
)}
style={
@@ -127,8 +127,7 @@ export const CodeBlockRenderer = forwardRef(function CodeBlockRenderer(
<code
className={tcls(
'table max-h-full w-fit min-w-full [counter-reset:line] print:max-h-none print:whitespace-pre-wrap',
withWrap && 'whitespace-pre-wrap',
'[[aria-expanded=false]_&]:mask-b-from-50%'
withWrap && 'whitespace-pre-wrap'
)}
>
{theme.lines.map((line, index) => (
@@ -36,14 +36,11 @@ export function OpenAPIPathMultipleServers(
};
});
// The store outlives client-side navigation, so it can hold a server from another spec.
const selectedServer = items.find((item) => item.key === key)?.key ?? defaultServer;
return (
<OpenAPIPathItem
copyType="button"
{...props}
value={`${withServer ? selectedServer : ''}${path}`}
value={`${withServer ? key : ''}${path}`}
context={context}
>
{withServer ? (