better support code blocks
This commit is contained in:
@@ -55,23 +55,27 @@ function CodeBlock({
|
|||||||
if (!match) {
|
if (!match) {
|
||||||
return <code className={className}>{children}</code>
|
return <code className={className}>{children}</code>
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SyntaxHighlighter
|
<SyntaxHighlighter
|
||||||
style={atomOneDark}
|
style={atomOneDark}
|
||||||
language={match[1]}
|
language={match[1]}
|
||||||
PreTag="div"
|
lineNumberStyle={{ color: 'var(--sea-ink-soft)' }}
|
||||||
|
wrapLongLines
|
||||||
|
showLineNumbers
|
||||||
customStyle={{
|
customStyle={{
|
||||||
|
width: '100%',
|
||||||
background: 'var(--surface)',
|
background: 'var(--surface)',
|
||||||
border: '1px solid var(--line)',
|
border: '1px solid var(--line)',
|
||||||
borderRadius: '0.75rem',
|
borderRadius: '0.75rem',
|
||||||
fontSize: '0.875rem',
|
fontSize: '0.875rem',
|
||||||
lineHeight: '1.7',
|
lineHeight: '1.7',
|
||||||
margin: '1.5rem 0',
|
|
||||||
padding: '1.25rem 1.5rem',
|
padding: '1.25rem 1.5rem',
|
||||||
}}
|
}}
|
||||||
codeTagProps={{
|
codeTagProps={{
|
||||||
style: { fontFamily: 'ui-monospace, monospace' },
|
style: { fontFamily: 'ui-monospace, monospace' },
|
||||||
}}
|
}}
|
||||||
|
wrapLines
|
||||||
>
|
>
|
||||||
{String(children).replace(/\n$/, '')}
|
{String(children).replace(/\n$/, '')}
|
||||||
</SyntaxHighlighter>
|
</SyntaxHighlighter>
|
||||||
|
|||||||
Reference in New Issue
Block a user