The beautiful docs framework for Next.js. Alternative to Nextra
MIT License
Bot releases are visible (Hide)
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
45a52ae: Support generating docs for OpenAPI schema
In openapi.config.js
:
/**
* @type {import("@fuma-docs/openapi").Config}
*/
module.exports = {
input: ['./petstore.yaml'],
output: './content/docs',
per: 'tag',
render: (title, description) => {
return {
frontmatter: [
'---',
`title: ${title}`,
`description: ${description}`,
'toc: false',
'---',
].join('\n'),
};
},
};
Run fuma-docs-openapi
to generate.
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
Published by fuma-nama 9 months ago
Published by github-actions[bot] 10 months ago
f995ad9: Page Footer is now a client component
This allows the footer component to find items within the current page tree, which fixes the problem where a item from another page tree is appeared.
Also removed the url
and tree
properties from DocsPage
since we can pass them via React Context API.
export default async function Page({ params }) {
return (
<DocsPage
- url={page.url}
- tree={pageTree}
>
...
</DocsPage>
);
}
The footer
property in DocsPage
has also updated, now you can specify or replace the default footer component.
<DocsPage footer={{ items: {} }}>...</DocsPage>
b30d1cd: Support theme presets
Add theme presets for the Tailwind CSS plugin, the default and ocean presets are available now.
const { docsUi, docsUiPlugins } = require('next-docs-ui/tailwind-plugin');
/** @type {import('tailwindcss').Config} */
module.exports = {
plugins: [
...docsUiPlugins,
docsUi({
preset: 'ocean',
}),
],
};
9929c5b: Support multiple page tree roots
You can specify a root
property in meta.json
, the nearest root folder will be used as the root of page tree instead.
{
"title": "Hello World",
"root": true
}
Published by github-actions[bot] 10 months ago
9929c5b: Migrate Contentlayer Integration to Source API
createContentlayer
is now replaced by createContentlayerSource
.
You should configure base URL and root directory in the loader instead of Contentlayer configuration.
It's no longer encouraged to access allDocs
directly because they will not include url
property anymore. Please consider getPages
instead.
import { allDocs, allMeta } from 'contentlayer/generated';
import { createContentlayerSource } from 'next-docs-zeta/contentlayer';
import { loader } from 'next-docs-zeta/source';
export const { getPage, pageTree, getPages } = loader({
baseUrl: '/docs',
rootDir: 'docs',
source: createContentlayerSource(allMeta, allDocs),
});
The interface is very similar, but you can only access Contentlayer properties from page.data
.
- <Content code={page.body.code} />
+ <Content code={page.data.body.code} />
9929c5b: Source API
To reduce boilerplate, the Source API is now released to handle File-system based files.
Thanks to this, you don't have to deal with the inconsistent behaviours between different content sources anymore.
The interface is now unified, you can easily plug in a content source.
import { map } from '@/.map';
import { createMDXSource } from 'next-docs-mdx';
import { loader } from 'next-docs-zeta/source';
export const { getPage, getPages, pageTree } = loader({
baseUrl: '/docs',
rootDir: 'docs',
source: createMDXSource(map),
});
Page Tree Builder API is removed in favor of this
49201be: Change remarkToc
to remarkHeading
The previous remarkToc
plugin only extracts table of contents from documents, now it also adds the id
property to all heading elements.
- import { remarkToc } from "next-docs-zeta/mdx-plugins"
+ import { remarkHeading } from "next-docs-zeta/mdx-plugins"
4c1334e: Improve createI18nMiddleware
function
Now, you can export the middleware directly without a wrapper.
From:
export default function middleware(request: NextRequest) {
return createI18nMiddleware(...);
}
To:
export default createI18nMiddleware({
defaultLanguage,
languages,
});
338ea98: Export create
function for Contentlayer configuration
If you want to include other document types, or override the output configuration, the create
function can return the fields and document types you need.
import { create } from 'next-docs-zeta/contentlayer/configuration';
const config = create(options);
export default {
contentDirPath: config.contentDirPath,
documentTypes: [config.Docs, config.Meta],
mdx: config.mdx,
};
9929c5b: Support multiple page tree roots
You can specify a root
property in meta.json
, the nearest root folder will be used as the root of page tree instead.
{
"title": "Hello World",
"root": true
}
Published by github-actions[bot] 10 months ago
9929c5b: Prefer .map.ts
instead of _map.ts
Unless you have especially configured, now it uses .map.ts
by default.
- import map from "@/_map"
+ import map from "@/.map"
9929c5b: Migrate to Source API
fromMap
has been removed. Please use createMDXSource
instead.
import { map } from '@/.map';
import { createMDXSource } from 'next-docs-mdx';
import { loader } from 'next-docs-zeta/source';
export const { getPage, getPages, pageTree } = loader({
baseUrl: '/docs',
rootDir: 'docs',
source: createMDXSource(map),
});
8fd769f: Support last modified timestamp for Git
Enable this in next.config.mjs
:
const withNextDocs = createNextDocs({
mdxOptions: {
lastModifiedTime: 'git',
},
});
Access it via page.data.exports.lastModified
.
Published by github-actions[bot] 10 months ago
Published by github-actions[bot] 10 months ago
6e0d2e1: Support Layout
for non-docs pages (without page tree)
Same as Docs Layout but doesn't include a sidebar. It can be used outside of the docs, a page tree is not required.
import { Layout } from 'next-docs-ui/layout';
export default function HomeLayout({ children }) {
return <Layout>{children}</Layout>;
}
nav.items
prop is deprecated
It is now replaced by links
.
2a82e9d: Support linking to accordions
You can now specify an id
for accordion. The accordion will automatically open when the user is navigating to the page with the specified id
in hash parameter.
<Accordions>
<Accordion title="My Title" id="my-title">
My Content
</Accordion>
</Accordions>
Published by github-actions[bot] 10 months ago
f39ae40: Forward ref to Link
and DynamicLink
component
Legacy import name SafeLink
is now removed
- import { SafeLink } from "next-docs-zeta/link"
+ import Link from "next-docs-zeta/link"
Published by github-actions[bot] 10 months ago
Published by github-actions[bot] 10 months ago
Published by github-actions[bot] 10 months ago
Published by github-actions[bot] 10 months ago