Skip to content

docs(website): open in playground button should not cover text #10019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
11 changes: 8 additions & 3 deletions packages/website/src/theme/CodeBlock/Content/String.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,17 @@ export default function CodeBlockString({
const showLineNumbers =
showLineNumbersProp ?? containsLineNumbers(metastring);

const copiedCode = code
const codeLines = code
.split('\n')
.filter(
(c, i) =>
!(lineClassNames[i] as string[] | undefined)?.includes(
'code-block-removed-line',
),
)
.join('\n');
);
const copiedCode = codeLines.join('\n');
const lastLineOfCodeLength = codeLines.at(-1)?.length ?? 0;
const needsMorePadding = lastLineOfCodeLength > 50;

const eslintrcHash = parseEslintrc(metastring);

Expand Down Expand Up @@ -90,6 +92,9 @@ export default function CodeBlockString({
<code
className={clsx(
styles.codeBlockLines,
eslintrcHash &&
needsMorePadding &&
styles.codeBlockLinesMorePadding,
showLineNumbers && styles.codeBlockLinesWithNumbering,
)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
padding: var(--ifm-pre-padding);
}

.codeBlockLinesMorePadding {
padding: var(--ifm-pre-padding) var(--ifm-pre-padding)
calc(var(--ifm-pre-padding) * 2.5);
}

.codeBlockLinesWithNumbering {
display: table;
padding: var(--ifm-pre-padding) 0;
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy