mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
feat(website): render syntax and mdx on the server (#9086)
This commit is contained in:
@@ -1,32 +1,15 @@
|
||||
'use client';
|
||||
import { Code } from 'bright';
|
||||
|
||||
import { PrismAsyncLight } from 'react-syntax-highlighter';
|
||||
import { vscDarkPlus, prism } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
||||
|
||||
export function SyntaxHighlighter({ language = 'typescript', code }: { code: string; language?: string }) {
|
||||
export function SyntaxHighlighter(props: typeof Code) {
|
||||
return (
|
||||
<>
|
||||
<div data-theme="dark">
|
||||
<PrismAsyncLight
|
||||
codeTagProps={{ style: { fontFamily: 'JetBrains Mono' } }}
|
||||
language={language}
|
||||
style={vscDarkPlus}
|
||||
wrapLines
|
||||
wrapLongLines
|
||||
>
|
||||
{code}
|
||||
</PrismAsyncLight>
|
||||
{/* @ts-expect-error async component */}
|
||||
<Code codeClassName="font-mono" lang={props.lang ?? 'typescript'} {...props} theme="github-dark-dimmed" />
|
||||
</div>
|
||||
<div data-theme="light">
|
||||
<PrismAsyncLight
|
||||
codeTagProps={{ style: { fontFamily: 'JetBrains Mono' } }}
|
||||
language={language}
|
||||
style={prism}
|
||||
wrapLines
|
||||
wrapLongLines
|
||||
>
|
||||
{code}
|
||||
</PrismAsyncLight>
|
||||
{/* @ts-expect-error async component */}
|
||||
<Code codeClassName="font-mono" lang={props.lang ?? 'typescript'} {...props} theme="min-light" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user