Feat/wiki #37
No files matched your search
+13
-16
@@ -1,31 +1,28 @@
|
||||
import { getWikiPageBySlug } from '@/lib/wiki';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import { MDXRemote } from 'next-mdx-remote/rsc';
|
||||
import { Callout } from '@/components/markdown/Callout';
|
||||
|
||||
const components = {
|
||||
Callout,
|
||||
};
|
||||
|
||||
type PageProps = {
|
||||
params: Promise<{
|
||||
slug: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
export default async function Page({ params }: PageProps) { const { slug } = await params;
|
||||
export default async function Page({ params }: PageProps) {
|
||||
const { slug } = await params;
|
||||
const article = await getWikiPageBySlug(slug);
|
||||
|
||||
if (!article) {
|
||||
notFound(); // Zeigt die 404-Seite, wenn z. B. installation.md nicht existiert
|
||||
}
|
||||
|
||||
return (
|
||||
<article className="max-w-3xl mx-auto p-6">
|
||||
<h1 className="text-3xl font-bold mb-2">{article.title}</h1>
|
||||
{article.updatedAt && (
|
||||
<p className="text-sm text-gray-500 mb-6">Stand: {article.updatedAt}</p>
|
||||
)}
|
||||
|
||||
{/* Gerendertes Markdown-HTML anzeigen */}
|
||||
<div
|
||||
className="prose max-w-none"
|
||||
dangerouslySetInnerHTML={{ __html: article.contentHtml }}
|
||||
/>
|
||||
<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={components} />
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export function Callout({ children, type = 'info' }: { children: React.ReactNode; type?: 'info' | 'warning' }) {
|
||||
const styles = type === 'warning'
|
||||
? 'bg-amber-500/10 border-amber-500 text-amber-200'
|
||||
: 'bg-blue-500/10 border-blue-500 text-blue-200';
|
||||
|
||||
return (
|
||||
<div className={`p-4 my-4 rounded-lg border-l-4 ${styles}`}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3,10 +3,11 @@ title: Installation & Setup
|
||||
updatedAt: "2026-08-04"
|
||||
----
|
||||
|
||||
> [!WARNING]
|
||||
> Dieses Projekt befindet sich noch in der aktiven Entwicklungsphase. Bitte verwende es noch nicht für den produktiven Einsatz.
|
||||
<Callout type="warning">
|
||||
Dieses Projekt befindet sich noch in der **aktiven Entwicklungsphase**. Bitte verwende es noch nicht für den produktiven Einsatz.
|
||||
</Callout>
|
||||
|
||||
## Installation
|
||||
# Installation
|
||||
|
||||
1. Repository klonen:
|
||||
```bash
|
||||
@@ -17,7 +18,7 @@ updatedAt: "2026-08-04"
|
||||
npm install
|
||||
```
|
||||
|
||||
## Setup
|
||||
# Setup
|
||||
|
||||
3. Prisma generieren
|
||||
```bash
|
||||
+3
-3
@@ -7,7 +7,7 @@ import html from 'remark-html';
|
||||
export type WikiArticle = {
|
||||
slug: string;
|
||||
title: string;
|
||||
contentHtml: string;
|
||||
rawContent: string;
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ const wikiDirectory = path.join(process.cwd(), "data/wiki/pages");
|
||||
|
||||
export async function getWikiPageBySlug(slug: string): Promise<WikiArticle | null> {
|
||||
try {
|
||||
const fullPath = path.join(wikiDirectory, `${slug}.md`);
|
||||
const fullPath = path.join(wikiDirectory, `${slug}.mdx`);
|
||||
const fileContents = fs.readFileSync(fullPath, "utf-8");
|
||||
|
||||
// read metadata
|
||||
@@ -29,7 +29,7 @@ export async function getWikiPageBySlug(slug: string): Promise<WikiArticle | nul
|
||||
|
||||
return {
|
||||
slug,
|
||||
contentHtml,
|
||||
rawContent: content,
|
||||
title: data.title || 'Unbenannt',
|
||||
updatedAt: data.updatedAt || null,
|
||||
...data,
|
||||
|
||||
+6
-1
@@ -13,11 +13,16 @@
|
||||
"better-sqlite3": "^12.11.1",
|
||||
"gray-matter": "^4.0.3",
|
||||
"next": "16.2.9",
|
||||
"next-mdx-remote": "^6.0.0",
|
||||
"papaparse": "^5.5.4",
|
||||
"react": "19.2.4",
|
||||
"react-dom": "19.2.4",
|
||||
"rehype-highlight": "^7.0.2",
|
||||
"rehype-stringify": "^10.0.1",
|
||||
"remark": "^15.0.1",
|
||||
"remark-html": "^16.0.1"
|
||||
"remark-html": "^16.0.1",
|
||||
"remark-parse": "^11.0.0",
|
||||
"remark-rehype": "^11.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "^4",
|
||||
|
||||
Generated
+622
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user