Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 34 additions & 19 deletions apps/docs/source.config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import remarkDirective from 'remark-directive';
import remarkDirective from "remark-directive";
import {
remarkDirectiveAdmonition,
remarkMdxFiles,
} from 'fumadocs-core/mdx-plugins';
import { remarkImage } from 'fumadocs-core/mdx-plugins';
} from "fumadocs-core/mdx-plugins";
import { remarkImage } from "fumadocs-core/mdx-plugins";
import {
defineConfig,
defineDocs,
frontmatterSchema,
metaSchema,
} from 'fumadocs-mdx/config';
import lastModified from 'fumadocs-mdx/plugins/last-modified';
import { z } from 'zod';
import convert from 'npm-to-yarn';
} from "fumadocs-mdx/config";
import lastModified from "fumadocs-mdx/plugins/last-modified";
import { z } from "zod";
import convert from "npm-to-yarn";

// You can customise Zod schemas for frontmatter and `meta.json` here
// see https://fumadocs.dev/docs/mdx/collections
export const docs = defineDocs({
dir: 'content/docs',
dir: "content/docs",
docs: {
schema: frontmatterSchema.extend({
image: z.string().optional(),
badge: z.enum(['early-access', 'deprecated', 'preview']).optional(),
badge: z.enum(["early-access", "deprecated", "preview"]).optional(),
url: z.string(),
metaTitle: z.string(),
metaDescription: z.string(),
Expand All @@ -37,11 +37,11 @@ export const docs = defineDocs({

// v6 docs collection
export const docsV6 = defineDocs({
dir: 'content/docs.v6',
dir: "content/docs.v6",
docs: {
schema: frontmatterSchema.extend({
image: z.string().optional(),
badge: z.enum(['early-access', 'deprecated', 'preview']).optional(),
badge: z.enum(["early-access", "deprecated", "preview"]).optional(),
url: z.string(),
metaTitle: z.string().optional(),
metaDescription: z.string().optional(),
Expand All @@ -60,7 +60,22 @@ export default defineConfig({
mdxOptions: {
remarkPlugins: [
remarkDirective,
remarkDirectiveAdmonition,
[
remarkDirectiveAdmonition,
{
types: {
note: "info",
tip: "info",
info: "info",
warn: "warning",
warning: "warning",
danger: "error",
success: "success",
ppg: "ppg",
error: "error",
Comment on lines +66 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Align tip mapping with Callout/docs semantics.
Line 68 maps tip"info", but the Callout mapping and docs treat tip as success. That will render :::tip as PPG/info. Please align either the config or the docs/mapping.

🔧 Suggested fix (if docs/callouts are the source of truth)
-            tip: "info",
+            tip: "success",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/docs/source.config.ts` around lines 66 - 75, The types mapping has tip
set to "info" but the Callout/docs treat `tip` as `success`; update the `types`
object in apps/docs/source.config.ts so the `tip` key maps to "success" (i.e.,
change the `tip: "info"` entry to `tip: "success"`) and verify other callout
keys (e.g., `danger`, `warn`, `error`) remain consistent with the docs; if the
docs are intended to change instead, update the docs/callout mapping to match
the current `tip: "info"` value instead.

},
},
],
[remarkImage, { useImport: false }],
remarkMdxFiles,
],
Expand All @@ -69,19 +84,19 @@ export default defineConfig({
},
remarkNpmOptions: {
persist: {
id: 'package-manager',
id: "package-manager",
},
packageManagers: [
{ command: (cmd: string) => convert(cmd, 'npm'), name: 'npm' },
{ command: (cmd: string) => convert(cmd, 'pnpm'), name: 'pnpm' },
{ command: (cmd: string) => convert(cmd, 'yarn'), name: 'yarn' },
{ command: (cmd: string) => convert(cmd, "npm"), name: "npm" },
{ command: (cmd: string) => convert(cmd, "pnpm"), name: "pnpm" },
{ command: (cmd: string) => convert(cmd, "yarn"), name: "yarn" },
{
command: (cmd: string) => {
const converted = convert(cmd, 'bun');
const converted = convert(cmd, "bun");
if (!converted) return undefined;
return converted.replace(/^bun x /, 'bunx --bun ');
return converted.replace(/^bun x /, "bunx --bun ");
},
name: 'bun',
name: "bun",
},
],
},
Expand Down
34 changes: 28 additions & 6 deletions apps/docs/src/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ import {
TableCell,
TableCaption,
Input,
Alert,
} from "@prisma-docs/eclipse";

export function getMDXComponents(components?: MDXComponents): MDXComponents {
const mdxComponents = {
const pageContext = (components as any)?._pageContext;

return {
...(icons as unknown as MDXComponents),
...defaultMdxComponents,
// Fumadocs tabs for manual usage (with items prop)
Expand All @@ -50,11 +53,6 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
APIPage,
img: (props: any) => <ImageZoom {...(props as any)} />,
input: (props: any) => <Input {...props} />,
};

const pageContext = (components as any)?._pageContext;

return {
...mdxComponents,
pre: ({ ref: _ref, ...props }) => (
<CodeBlock {...props}>
Expand All @@ -69,5 +67,29 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
th: ({ ref: _ref, ...props }) => <TableHead {...props} />,
td: ({ ref: _ref, ...props }) => <TableCell {...props} />,
caption: ({ ref: _ref, ...props }) => <TableCaption {...props} />,
// Override Fumadocs Callout components with Eclipse Alert for admonitions (:::ppg, :::error, :::success, :::warning)
CalloutTitle: ({ children }: any) => <>{children}</>,
CalloutDescription: ({ children }: any) => <>{children}</>,
CalloutContainer: ({ type, children, icon, ...props }: any) => {
const variantMap: Record<
string,
"ppg" | "error" | "success" | "warning"
> = {
ppg: "ppg",
error: "error",
success: "success",
warning: "warning",
info: "ppg",
note: "ppg",
tip: "success",
danger: "error",
};

return (
<Alert variant={variantMap[type] || "ppg"} icon={icon} {...props}>
{children}
</Alert>
);
},
};
}
Loading
Loading