add wrapLongLines option to CodeSnippet

Signed-off-by: Antonio Ereiz <antonio.ereiz@gmail.com>
This commit is contained in:
Antonio Ereiz
2025-09-15 22:35:29 +02:00
parent 39a15fdf4d
commit 5d7d3ea152
@@ -57,6 +57,14 @@ export interface CodeSnippetProps {
* Array of line numbers to highlight
*/
highlightedNumbers?: number[];
/**
* Whether to style the `<code>` block with `white-space: pre-wrap` or `white-space: pre`
*
* @remarks
*
* Default: false (`white-space: pre`)
*/
wrapLongLines?: boolean;
/**
* Custom styles applied to code
*
@@ -79,6 +87,7 @@ export function CodeSnippet(props: CodeSnippetProps) {
language,
showLineNumbers = false,
highlightedNumbers,
wrapLongLines,
customStyle,
showCopyCodeButton = false,
} = props;
@@ -94,6 +103,7 @@ export function CodeSnippet(props: CodeSnippetProps) {
style={mode}
showLineNumbers={showLineNumbers}
wrapLines
wrapLongLines={wrapLongLines}
lineNumberStyle={{ color: theme.palette.textVerySubtle }}
lineProps={(lineNumber: number) =>
highlightedNumbers?.includes(lineNumber)