fix: update docs & optimize docs layout & pages

- Translated the title and paragraphs in multiple .mdx files from Chinese to English for consistency and clarity.
- Adjusted the layout.tsx to change the font class for improved typography.
- Enhanced the Providers component with detailed comments for better understanding of the provider structure.
This commit is contained in:
javayhu 2025-03-30 10:34:49 +08:00
parent 584d3faa1a
commit c3a774e1cb
14 changed files with 116 additions and 54 deletions

View File

@ -18,12 +18,16 @@ description: MkSaaS 是构建 AI SaaS 网站的最佳代码模板。
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -18,12 +18,16 @@ description: MkSaaS 是构建 AI SaaS 网站的最佳代码模板。
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -24,12 +24,16 @@ locale: zh
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -24,12 +24,16 @@ locale: zh
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -24,12 +24,16 @@ locale: zh
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -24,12 +24,16 @@ locale: zh
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -24,12 +24,16 @@ locale: zh
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -24,12 +24,16 @@ locale: zh
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -24,12 +24,16 @@ locale: zh
```html
<article class="prose">
<h1>大蒜面包配奶酪:科学告诉我们什么</h1>
<h1>Garlic bread with cheese: What the science tells us</h1>
<p>
多年来,父母一直向他们的孩子宣扬吃大蒜面包配奶酪的健康益处,这种食物在我们的文化中获得了如此标志性的地位,以至于孩子们经常在万圣节装扮成温暖、奶酪味的面包。
For years parents have espoused the health benefits of eating garlic bread
with cheese to their children, with the food earning such an iconic status
in our culture that kids will often dress up as warm, cheesy loaf for
Halloween.
</p>
<p>
但最近的一项研究表明,这种受欢迎的开胃菜可能与全国各地出现的一系列狂犬病病例有关。
But a recent study shows that the celebrated appetizer may be linked to a
series of rabies cases springing up around the country.
</p>
</article>
```

View File

@ -16,13 +16,13 @@ import { Mdx } from '@/components/shared/mdx-component';
export function generateStaticParams() {
const locales = LOCALES;
const slugParams = source.generateParams();
const params = locales.flatMap(locale =>
const params = locales.flatMap(locale =>
slugParams.map(param => ({
locale,
slug: param.slug
}))
);
return params;
}
@ -63,7 +63,12 @@ export default async function Page({
}
return (
<DocsPage toc={page.data.toc} full={page.data.full}>
<DocsPage toc={page.data.toc}
full={page.data.full}
tableOfContent={{
style: "clerk",
}}
>
<DocsTitle>
{page.data.title}
</DocsTitle>

View File

@ -1,4 +1,9 @@
import { Icons } from '@/components/icons/icons';
import { ModeSwitcher } from '@/components/layout/mode-switcher';
import { Logo } from '@/components/logo';
import { websiteConfig } from '@/config';
import { LOCALE_LIST } from '@/i18n/routing';
import { docsI18nConfig } from '@/lib/docs/i18n';
import { source } from '@/lib/docs/source';
import { I18nProvider, Translations } from 'fumadocs-ui/i18n';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
@ -6,11 +11,6 @@ import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import { Locale } from 'next-intl';
import { getTranslations } from 'next-intl/server';
import type { ReactNode } from 'react';
import { DocsProviders } from './providers-docs';
import { ModeSwitcher } from '@/components/layout/mode-switcher';
import { Logo } from '@/components/logo';
import { websiteConfig } from '@/config';
import { docsI18nConfig } from '@/lib/docs/i18n';
import '@/styles/docs.css';
@ -41,6 +41,7 @@ export default async function DocsRootLayout({ children, params }: DocsLayoutPro
chooseLanguage: t('chooseLanguage'),
};
// Docs layout configurations
const baseOptions: BaseLayoutProps = {
i18n: docsI18nConfig,
githubUrl: websiteConfig.social.github ?? undefined,
@ -57,7 +58,18 @@ export default async function DocsRootLayout({ children, params }: DocsLayoutPro
text: t('homepage'),
url: '/',
active: 'nested-url',
}
},
...(websiteConfig.social.twitter
? [
{
type: "icon" as const,
icon: <Icons.x />,
text: "X",
url: websiteConfig.social.twitter,
secondary: true,
}
]
: [])
],
themeSwitch: {
enabled: true,
@ -67,16 +79,14 @@ export default async function DocsRootLayout({ children, params }: DocsLayoutPro
};
return (
// <DocsProviders>
<I18nProvider
locales={locales}
locale={locale}
translations={translations}
>
<DocsLayout tree={source.pageTree[locale]} {...baseOptions}>
{children}
</DocsLayout>
</I18nProvider>
// </DocsProviders>
<I18nProvider
locales={locales}
locale={locale}
translations={translations}
>
<DocsLayout tree={source.pageTree[locale]} {...baseOptions}>
{children}
</DocsLayout>
</I18nProvider>
);
}

View File

@ -39,7 +39,7 @@ export default async function LocaleLayout({
suppressHydrationWarning
className={cn(
'size-full antialiased',
fontDMSans.className,
fontBricolageGrotesque.className,
fontDMSans.variable,
fontDMMono.variable,
fontDMSerifText.variable,

View File

@ -1,12 +1,21 @@
'use client';
import * as React from 'react';
import { ThemeProvider, useTheme } from 'next-themes';
import { TooltipProvider } from '@/components/ui/tooltip';
import { PropsWithChildren } from 'react';
import { ActiveThemeProvider } from '@/components/layout/active-theme';
import { TooltipProvider } from '@/components/ui/tooltip';
import { RootProvider } from 'fumadocs-ui/provider';
import { ThemeProvider, useTheme } from 'next-themes';
import { PropsWithChildren } from 'react';
/**
* Providers
*
* This component is used to wrap the app in the providers.
*
* - ThemeProvider: Provides the theme to the app.
* - ActiveThemeProvider: Provides the active theme to the app.
* - RootProvider: Provides the root provider for Fumadocs UI.
* - TooltipProvider: Provides the tooltip to the app.
*/
export function Providers({ children }: PropsWithChildren) {
const theme = useTheme();
@ -19,7 +28,9 @@ export function Providers({ children }: PropsWithChildren) {
>
<ActiveThemeProvider>
<RootProvider theme={theme}>
<TooltipProvider>{children}</TooltipProvider>
<TooltipProvider>
{children}
</TooltipProvider>
</RootProvider>
</ActiveThemeProvider>
</ThemeProvider>

View File

@ -329,7 +329,7 @@ body {
/* Standalone code elements */
code {
@apply relative rounded px-[0.3rem] py-[0.2rem] font-mono text-sm font-medium text-foreground bg-accent;
@apply relative rounded px-[0.3rem] py-[0.2rem] text-foreground bg-accent;
}
/* Code elements inside pre */