初始化
sh
cd ../
npm init
pnpm add next react react-dom nextra nextra-theme-docs
添加 package.json
json
"scripts": {
"dev": "next",
"start": "next start",
"build": "next build",
},
添加 next.config.js
js
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.jsx",
});
module.exports = withNextra();
添加 theme.config.jsx
js
export default {
logo: <span>My Nextra Documentation</span>,
project: {
link: "https://github.com/shuding/nextra",
},
// ... other theme options
};
启动
sh
pnpm dev || yarn dev || npm dev