next-markdown
lets you build your documentation.
You probably want to display a navigation, with a previous, next etc.
This ☝️ is generated from the following file tree
To do so you can use the function getStaticPropsForNextmd
which returns the static props for the given nextmd
of your choice.
This way you can customize your export default getStaticProps
. Like so
export const getStaticProps = async (context: GetStaticPropsContext<{ nextmd: string[] }>) => {
if (context.params?.nextmd.includes("docs"))) { // ⬅️ if path contains "docs", then shape your own results
// every docs pages will have "nav" so you can render a navigation panel
return {
props: {
...(await nextmd.getStaticProps(context)).props,
nav: [
{ title: 'Getting Started', ...(await nextmd.getStaticPropsForNextmd(['docs', 'getting-started'])) },
{ title: 'Features', ...(await nextmd.getStaticPropsForNextmd(['docs', 'features'])) },
{ title: 'Examples', ...(await nextmd.getStaticPropsForNextmd(['docs', 'examples'])) },
],
},
};
} else {
return nextmd.getStaticProps(context);
}
};
git clone https://github.com/frouo/next-markdown.git
cd next-markdown
npm install
npm run build
cd examples/documentation/
npm install
npm run dev