style: add automatic colors to code

This commit is contained in:
robin committed 2026-08-04 15:53:13 +02:00
1 parent 14be41befd
commit 592b1a158a
7 files changed
+309 -4

No files matched your search

+15
View File
@@ -43,4 +43,19 @@ h1 {
.steps-container .relative div:first-child::before {
content: counter(step);
}
/* Shiki Code-Blöcke stylen */
pre {
padding: 1rem;
border-radius: 0.75rem;
border: 1px solid #27272a; /* Tailwind zinc-800 */
overflow-x: auto;
font-size: 0.875rem;
}
pre code {
background-color: transparent !important;
padding: 0 !important;
border: none !important;
}
+21 -2
View File
@@ -1,8 +1,23 @@
import { getWikiPageBySlug } from '@/lib/wiki';
import { notFound } from 'next/navigation';
import rehypePrettyCode from 'rehype-pretty-code';
import { MDXRemote } from 'next-mdx-remote/rsc';
import { Callout, Grid, Card, Steps, Step } from '@/components/mdx-components';
import { Callout, Grid, Card, Steps, Step, InlineCode, PreBlock } from '@/components/mdx-components';
const mdxOptions = {
mdxOptions: {
rehypePlugins: [
[
rehypePrettyCode,
{
theme: 'github-dark', // oder 'one-dark-pro', 'nord', etc.
keepBackground: true,
},
],
],
},
};
const mdxComponents = {
Callout,
@@ -31,7 +46,11 @@ export default async function Page({ params }: PageProps) {
<article className="prose prose-invert max-w-none p-6">
<h1>{article.title}</h1>
{/* Direkte MDX-Rendering-Komponente von Next.js */}
<MDXRemote source={article.rawContent} components={mdxComponents} />
<MDXRemote
source={article.rawContent}
components={mdxComponents}
options={mdxOptions as any}
/>
</article>
);
}