feat(docs): add technical features documentation and apply consistent formatting

Added a detailed technical features section to the documentation, covering key functionalities of Memegoat. Improved consistency in formatting across documentation and source files.
This commit is contained in:
Mathis HERRIOT
2026-01-05 16:29:31 +01:00
parent 38e97741e0
commit 86543eeb4f
6 changed files with 84 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
'use client';
"use client";
import { use, useEffect, useId, useState } from 'react';
import { useTheme } from 'next-themes';
import { use, useEffect, useId, useState } from "react";
import { useTheme } from "next-themes";
export function Mermaid({ chart }: { chart: string }) {
const [mounted, setMounted] = useState(false);
@@ -16,7 +16,10 @@ export function Mermaid({ chart }: { chart: string }) {
const cache = new Map<string, Promise<unknown>>();
function cachePromise<T>(key: string, setPromise: () => Promise<T>): Promise<T> {
function cachePromise<T>(
key: string,
setPromise: () => Promise<T>,
): Promise<T> {
const cached = cache.get(key);
if (cached) return cached as Promise<T>;
@@ -28,19 +31,21 @@ function cachePromise<T>(key: string, setPromise: () => Promise<T>): Promise<T>
function MermaidContent({ chart }: { chart: string }) {
const id = useId();
const { resolvedTheme } = useTheme();
const { default: mermaid } = use(cachePromise('mermaid', () => import('mermaid')));
const { default: mermaid } = use(
cachePromise("mermaid", () => import("mermaid")),
);
mermaid.initialize({
startOnLoad: false,
securityLevel: 'loose',
fontFamily: 'inherit',
themeCSS: 'margin: 1.5rem auto 0;',
theme: resolvedTheme === 'dark' ? 'dark' : 'default',
securityLevel: "loose",
fontFamily: "inherit",
themeCSS: "margin: 1.5rem auto 0;",
theme: resolvedTheme === "dark" ? "dark" : "default",
});
const { svg, bindFunctions } = use(
cachePromise(`${chart}-${resolvedTheme}`, () => {
return mermaid.render(id, chart.replaceAll('\\n', '\n'));
return mermaid.render(id, chart.replaceAll("\\n", "\n"));
}),
);
@@ -53,4 +58,4 @@ function MermaidContent({ chart }: { chart: string }) {
dangerouslySetInnerHTML={{ __html: svg }}
/>
);
}
}

View File

@@ -1,6 +1,6 @@
import defaultMdxComponents from "fumadocs-ui/mdx";
import type { MDXComponents } from "mdx/types";
import {Mermaid} from "@/components/mdx/mermaid";
import { Mermaid } from "@/components/mdx/mermaid";
export function getMDXComponents(components?: MDXComponents): MDXComponents {
return {