Skip to content

Latest commit

 

History

History

documentation

Documentation

next-markdown lets you build your documentation.

How

You probably want to display a navigation, with a previous, next etc.

website

This ☝️ is generated from the following file tree

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);
  }
};

Demo

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

open http://localhost:3000