feat: update docs

This commit is contained in:
pomelo-nwu
2025-12-09 20:16:03 +08:00
parent 70b5aee381
commit e12a80b24e
14 changed files with 205 additions and 170 deletions

54
docs-site/README.md Normal file
View File

@@ -0,0 +1,54 @@
# Qwen Code Docs Site
A documentation website for Qwen Code built with [Next.js](https://nextjs.org/) and [Nextra](https://nextra.site/).
## Getting Started
### Prerequisites
- Node.js 18+
- npm or yarn
### Installation
```bash
npm install
```
### Setup Content
Link the documentation content from the parent `docs` directory:
```bash
npm run link
```
This creates a symbolic link from `../docs` to `content` in the project.
### Development
Start the development server:
```bash
npm run dev
```
Open [http://localhost:3000](http://localhost:3000) in your browser to see the documentation site.
## Project Structure
```
docs-site/
├── src/
│ └── app/
│ ├── [[...mdxPath]]/ # Dynamic routing for MDX pages
│ │ └── page.jsx
│ └── layout.jsx # Root layout with navbar and footer
├── mdx-components.js # MDX component configuration
├── next.config.mjs # Next.js configuration
└── package.json
```
## License
MIT © Qwen Team

View File

@@ -0,0 +1,12 @@
import { useMDXComponents as getThemeComponents } from 'nextra-theme-docs'; // nextra-theme-blog or your custom theme
// Get the default MDX components
const themeComponents = getThemeComponents();
// Merge components
export function useMDXComponents(components) {
return {
...themeComponents,
...components,
};
}

6
docs-site/next-env.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import './.next/dev/types/routes.d.ts';
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -0,0 +1,5 @@
import nextra from 'nextra';
const withNextra = nextra({});
export default withNextra({});

21
docs-site/package.json Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "docs-site",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"type": "module",
"main": "index.js",
"scripts": {
"link": "ln -s ../docs content",
"dev": "next --turbopack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"next": "^16.0.8",
"nextra": "^4.6.1",
"nextra-theme-docs": "^4.6.1",
"react": "^19.2.1",
"react-dom": "^19.2.1"
}
}

View File

@@ -0,0 +1,27 @@
import { generateStaticParamsFor, importPage } from 'nextra/pages';
import { useMDXComponents as getMDXComponents } from '../../../mdx-components';
export const generateStaticParams = generateStaticParamsFor('mdxPath');
export async function generateMetadata(props) {
const params = await props.params;
const { metadata } = await importPage(params.mdxPath);
return metadata;
}
const Wrapper = getMDXComponents().wrapper;
export default async function Page(props) {
const params = await props.params;
const {
default: MDXContent,
toc,
metadata,
sourceCode,
} = await importPage(params.mdxPath);
return (
<Wrapper toc={toc} metadata={metadata} sourceCode={sourceCode}>
<MDXContent {...props} params={params} />
</Wrapper>
);
}

View File

@@ -0,0 +1,51 @@
import { Footer, Layout, Navbar } from 'nextra-theme-docs';
import { Banner, Head } from 'nextra/components';
import { getPageMap } from 'nextra/page-map';
import 'nextra-theme-docs/style.css';
export const metadata = {
// Define your metadata here
// For more information on metadata API, see: https://nextjs.org/docs/app/building-your-application/optimizing/metadata
};
const banner = (
<Banner storageKey="some-key">Qwen Code 0.5.0 is released 🎉</Banner>
);
const navbar = (
<Navbar
logo={<b>Qwen Code</b>}
// ... Your additional navbar options
/>
);
const footer = <Footer>MIT {new Date().getFullYear()} © Qwen Team.</Footer>;
export default async function RootLayout({ children }) {
return (
<html
// Not required, but good for SEO
lang="en"
// Required to be set
dir="ltr"
// Suggested by `next-themes` package https://github.com/pacocoursey/next-themes#with-app
suppressHydrationWarning
>
<Head
// ... Your additional head options
>
{/* Your additional tags should be passed as `children` of `<Head>` element */}
</Head>
<body>
<Layout
banner={banner}
navbar={navbar}
pageMap={await getPageMap()}
docsRepositoryBase="https://github.com/QwenLM/qwen-code/docs"
footer={footer}
// ... Your additional layout options
>
{children}
</Layout>
</body>
</html>
);
}