mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> feat(docs): centralize code examples with dynamic variant tabs This PR introduces a system for managing code examples centrally while supporting file-based variant tabs (like html/script) within a single code block. ## Changes - **Extended variant system**: `PlatformCodeblock` now supports custom variant names beyond just 'server'/'client', enabling tabs for any file grouping (e.g., html/script pairs) - **Vite example migration**: Moved vite-example.mdx code to `code-examples/vite-example.ts` with html/script variants - **LLM copy support**: The "Copy Markdown" button now expands `PlatformCodeblock` components to inline the actual code, so LLMs receive the full code examples instead of component references ## How it works Code examples with variants are now displayed with filename-based tabs: - Define examples with `variant: 'html'` and `variant: 'script'` in `code-examples/` - The tab labels automatically use the `filename` property - When copying markdown for LLMs, all variants are included with their filenames <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Documentation** * Added a Vite JavaScript example guide with grouped auth examples (init, index, password, OTP, OAuth) and wired examples into the getting-started navigation. * Removed the previous multi-page example guide and replaced it with the new Vite-focused page. * Documentation generation now expands platform code blocks to inline concrete examples for clearer rendered docs. * **Refactor** * Improved code-example variant handling to support flexible variant names for better tabbed/code-sample organization. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|---|---|---|
| .. | ||
| code-examples | ||
| content | ||
| lib | ||
| public | ||
| scripts | ||
| src | ||
| templates | ||
| templates-api | ||
| templates-python | ||
| .env.development | ||
| .eslintrc.json | ||
| .gitignore | ||
| CHANGELOG.md | ||
| cli.json | ||
| next.config.mjs | ||
| package.json | ||
| postcss.config.mjs | ||
| README.md | ||
| source.config.ts | ||
| tsconfig.json | ||
stack-docs
This is a Next.js application generated with Create Fumadocs.
Run development server:
npm run dev
# or
pnpm dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
Explore
In the project, you can see:
lib/source.ts: Code for content source adapter,loader()provides the interface to access your content.app/layout.config.tsx: Shared options for layouts, optional but preferred to keep.
| Route | Description |
|---|---|
app/(home) |
The route group for your landing page and other pages. |
app/docs |
The documentation layout and pages. |
app/api |
The documentation for API pages. |
app/api/search/route.ts |
The Route Handler for search. |
Fumadocs MDX
A source.config.ts config file has been included, you can customise different options like frontmatter schema.
Read the Introduction for further details.
Learn More
To learn more about Next.js and Fumadocs, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
- Fumadocs - learn about Fumadocs