The beautiful docs framework for Next.js. Alternative to Nextra
MIT License
Bot releases are visible (Hide)
Published by github-actions[bot] 10 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
983ede8: Remove not-found
component
The not-found
component was initially intended to be the default 404 page. However, we found that the Next.js default one is good enough. For advanced cases, you can always build your own 404 page.
ebe8d9f: Support Tailwind CSS plugin usage
If you are using Tailwind CSS for your docs, it's now recommended to use the official plugin instead.
const { docsUi, docsUiPlugins } = require('next-docs-ui/tailwind-plugin');
/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: 'class',
content: [
'./components/**/*.{ts,tsx}',
'./app/**/*.{ts,tsx}',
'./content/**/*.mdx',
'./node_modules/next-docs-ui/dist/**/*.js',
],
plugins: [...docsUiPlugins, docsUi],
};
The docsUi
plugin adds necessary utilities & colors, and docsUiPlugins
are its dependency plugins which should not be missing.
7d89e83: Add required property url
to <DocsPage />
component
You must pass the URL of current page to <DocsPage />
component.
export default function Page({ params }) {
return (
<DocsPage
+ url={page.url}
toc={page.data.toc}
>
...
</DocsPage>
)
}
footer
property is now optional
Your footer
property in <DocsPage />
will be automatically generated if not specified.
findNeighbour(tree, url);
0599d50: Separate MDX components
Previously, you can only import the code block component from next-docs-ui/mdx
(Client Component) and next-docs-ui/mdx-server
(Server Component).
This may lead to confusion, hence, it is now separated into multiple files. You can import these components regardless it is either a client or a server component.
Notice that MDXContent
is now renamed to DocsBody
, you must import it from next-docs-ui/page
instead.
- import { MDXContent } from "next-docs-ui/mdx"
- import { MDXContent } from "next-docs-ui/mdx-server"
+ import { DocsBody } from "next-docs-ui/page"
- import { Card, Cards } from "next-docs-ui/mdx"
+ import { Card, Cards } from "next-docs-ui/mdx/card"
- import { Pre } from "next-docs-ui/mdx"
+ import { Pre } from "next-docs-ui/mdx/pre"
- import { Heading } from "next-docs-ui/mdx"
+ import { Heading } from "next-docs-ui/mdx/heading"
- import defaultComponents from "next-docs-ui/mdx"
+ import defaultComponents from "next-docs-ui/mdx/default-client"
- import defaultComponents from "next-docs-ui/mdx-server"
+ import defaultComponents from "next-docs-ui/mdx/default"
searchOptions
in Algolia Search Dialogpre
element inside code blocksPublished by github-actions[bot] 11 months ago
69f8abf: Make file paths relative to rootDir
when resolving files
For a more simplified usage, the resolved file paths will be relative to rootDir
.
You can now generate slugs automatically depending on the root directory you have configured.
const utils = fromMap(map, {
rootDir: 'ui',
schema: {
frontmatter: frontmatterSchema,
},
});
The configuration above will generate /hello
slugs for a file named /content/ui/hello.mdx
, while the previous one generates /ui/hello
.
9ef047d: Pre-bundle page urls into raw pages.
This means you don't need getPageUrl
anymore for built-in adapters, including next-docs-mdx
and Contentlayer. It is now replaced by the url
property from the pages array provided by your adapter.
Due to this change, your old configuration might not continues to work.
import { fromMap } from 'next-docs-mdx/map'
fromMap({
- slugs: ...
+ getSlugs: ...
})
For Contentlayer, the getUrl
option is now moved to createConfig
.
1c187b9: Support intelligent schema types
The validate
options is now renamed to schema
.
import { defaultSchemas, fromMap } from 'next-docs-mdx/map';
const utils = fromMap(map, {
rootDir: 'docs/ui',
baseUrl: '/docs/ui',
schema: {
frontmatter: defaultSchemas.frontmatter.extend({
preview: z.string().optional(),
}),
},
});
The frontmatter
field on pages should be automatically inferred to your Zod schema type.
52b24a6: Remove /docs
from default root content path
Previously, the default root content path is ./content/docs
. All your documents must be placed under the root directory.
Since this update, it is now ./content
by default. To keep the old behaviours, you may manually specify rootContentPath
.
const withNextDocs = createNextDocs({
rootContentPath: './content/docs',
});
Notice that due to this change, your baseUrl
property will be /
by default
const withNextDocs = createNextDocs({
+ baseUrl: "/docs"
})
2ff7581: Rename configuration options
The options of createNextDocs
is now renamed to be more flexible and straightforward.
Old | New |
---|---|
dataExports |
mdxOptions.valueToExport |
pluginOptions |
mdxOptions.rehypeNextDocsOptions |
rehypePlugins
and remarkPlugins
can also be a function that accepts and returns plugins.
55a2321: Use @mdx-js/mdx
to process MDX/markdown files.
You no longer need @next/loader
and @mdx-js/loader
to be installed on your project, next-docs-mdx
will process files with @mdx-js/mdx
directly.
This change will not break most of the projects
Published by github-actions[bot] 11 months ago
9ef047d: Pre-bundle page urls into raw pages.
This means you don't need getPageUrl
anymore for built-in adapters, including next-docs-mdx
and Contentlayer. It is now replaced by the url
property from the pages array provided by your adapter.
Due to this change, your old configuration might not continues to work.
import { fromMap } from 'next-docs-mdx/map'
fromMap({
- slugs: ...
+ getSlugs: ...
})
For Contentlayer, the getUrl
option is now moved to createConfig
.
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
enableThemeProvider
option in RootProviderPublished by github-actions[bot] 11 months ago
remark-structure
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago
Published by github-actions[bot] 11 months ago