fix: shiki stlying
This commit is contained in:
parent
d94ba356fb
commit
d8e37d0b21
BIN
web/bun.lockb
BIN
web/bun.lockb
Binary file not shown.
@ -3,9 +3,6 @@ const nextConfig = {
|
|||||||
eslint: {
|
eslint: {
|
||||||
ignoreDuringBuilds: true,
|
ignoreDuringBuilds: true,
|
||||||
},
|
},
|
||||||
experimental: {
|
|
||||||
serverComponentsExternalPackages: ["shiki"],
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = nextConfig;
|
module.exports = nextConfig;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
"react-dom": "^18",
|
"react-dom": "^18",
|
||||||
"react-hook-form": "^7.48.2",
|
"react-hook-form": "^7.48.2",
|
||||||
"react-use-websocket": "^4.5.0",
|
"react-use-websocket": "^4.5.0",
|
||||||
"shiki": "^0.14.6",
|
"shikiji": "^0.9.3",
|
||||||
"sonner": "^1.2.4",
|
"sonner": "^1.2.4",
|
||||||
"tailwind-merge": "^2.1.0",
|
"tailwind-merge": "^2.1.0",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { CopyButton } from "@/components/CopyButton";
|
import { CopyButton } from "@/components/CopyButton";
|
||||||
import type { Lang } from "shiki";
|
import { getHighlighter, StringLiteralUnion } from 'shikiji'
|
||||||
import shiki from "shiki";
|
|
||||||
|
|
||||||
export async function CodeBlock(props: { code: string; lang: Lang }) {
|
export async function CodeBlock(props: { code: string; lang: StringLiteralUnion<string> }) {
|
||||||
const highlighter = await shiki.getHighlighter({
|
const highlighter = await getHighlighter({
|
||||||
theme: "one-dark-pro",
|
themes: ["one-dark-pro"],
|
||||||
|
langs: [props.lang]
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -20,6 +20,7 @@ export async function CodeBlock(props: { code: string; lang: Lang }) {
|
|||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: highlighter.codeToHtml(props.code.trim(), {
|
__html: highlighter.codeToHtml(props.code.trim(), {
|
||||||
lang: props.lang,
|
lang: props.lang,
|
||||||
|
theme: "one-dark-pro",
|
||||||
}),
|
}),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user