add wrapLongLines option to CodeSnippet
Signed-off-by: Antonio Ereiz <antonio.ereiz@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user