mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
UI & OpenAPI: Use full mode on docs pages by default on OpenAPI generated pages
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'fumadocs-openapi': patch
|
||||
'fumadocs-mdx': patch
|
||||
---
|
||||
|
||||
Use full mode on docs pages by default on OpenAPI generated pages
|
||||
@@ -49,7 +49,7 @@ export default function Page({
|
||||
<DocsPage
|
||||
toc={page.data.exports.toc}
|
||||
lastUpdate={page.data.exports.lastModified}
|
||||
full={!page.data.toc}
|
||||
full={page.data.full}
|
||||
tableOfContent={{
|
||||
footer,
|
||||
}}
|
||||
|
||||
@@ -22,6 +22,7 @@ By default, it includes:
|
||||
| `title` | The title of page |
|
||||
| `description` | The description of page |
|
||||
| `icon` | The name of icon, see [Icons](#icons) |
|
||||
| `full` | Enable full mode on the page |
|
||||
|
||||
You may extend your content source to add additional properties.
|
||||
|
||||
@@ -29,6 +30,8 @@ You may extend your content source to add additional properties.
|
||||
---
|
||||
title: My Page
|
||||
description: Best document ever
|
||||
icon: HomeIcon
|
||||
full: false
|
||||
---
|
||||
|
||||
## Learn More
|
||||
|
||||
@@ -6,9 +6,6 @@ void OpenAPI.generateFiles({
|
||||
input: ['./*.yaml'],
|
||||
output: './content/docs/ui',
|
||||
per: 'tag',
|
||||
frontmatter: () => ({
|
||||
toc: false,
|
||||
}),
|
||||
renderer: {
|
||||
Root(child) {
|
||||
return OpenAPI.createElement(
|
||||
|
||||
@@ -17,7 +17,6 @@ export const utils = loader({
|
||||
schema: {
|
||||
frontmatter: defaultSchemas.frontmatter.extend({
|
||||
preview: z.string().optional(),
|
||||
toc: z.boolean().default(true),
|
||||
index: z.boolean().default(false),
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@ export default async function Page({
|
||||
const MDX = page.data.exports.default;
|
||||
|
||||
return (
|
||||
<DocsPage toc={page.data.exports.toc}>
|
||||
<DocsPage toc={page.data.exports.toc} full={page.data.full}>
|
||||
<DocsBody>
|
||||
<h1>{page.data.title}</h1>
|
||||
<MDX />
|
||||
|
||||
@@ -17,7 +17,7 @@ export default async function Page({
|
||||
const MDX = page.data.exports.default;
|
||||
|
||||
return (
|
||||
<DocsPage toc={page.data.exports.toc}>
|
||||
<DocsPage toc={page.data.exports.toc} full={page.data.full}>
|
||||
<DocsBody>
|
||||
<h1>{page.data.title}</h1>
|
||||
<MDX />
|
||||
|
||||
@@ -12,6 +12,7 @@ const frontmatterSchema = z.object({
|
||||
title: z.string(),
|
||||
description: z.string().optional(),
|
||||
icon: z.string().optional(),
|
||||
full: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const defaultSchemas = {
|
||||
|
||||
@@ -18,7 +18,9 @@ export interface GenerateOptions {
|
||||
}[];
|
||||
|
||||
/**
|
||||
* Customise frontmatter
|
||||
* Customise frontmatter.
|
||||
*
|
||||
* A `full: true` property will be added by default.
|
||||
*/
|
||||
frontmatter?: (
|
||||
title: string,
|
||||
|
||||
@@ -11,6 +11,7 @@ export function renderPage(
|
||||
const banner = dump({
|
||||
title,
|
||||
description,
|
||||
full: true,
|
||||
...options.frontmatter?.(title, description),
|
||||
}).trim();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user