Skip to main content

Setting up Docusaurus

Sidebars#

jsdoc-to-mdx will generate sidebars-api.js if the path to it is given.
You can import that file in the sidebars.js file that Docusaurus generates.

sidebars.js
module.exports = {  docs: [    // Other docs    "installation",    "setting-up-docusaurus"  ],  // Import generated sidebars-api.js  ...require("./sidebars-api.js")};

By this, the sidebar of generated mdx files will be available with the id "api"

docusaurus.config.js#

Navbar settings#

You can add a navigation bar item to the generated api document.

docusaurus.config.js
navbar: {  items: [    {      type: "doc",      docId: "api/FirstItemToShow",      label: "API",      position: "left"    }  ]}

Markdown plugins#

Using the remark-breaks plugin is highly recommended.

docusaurus.config.js
presets: [  [    '@docusaurus/preset-classic',    /** @type {import('@docusaurus/preset-classic').Options} */    ({      docs: {        sidebarPath: require.resolve('./sidebars.js'),        // Please change this to your repo.        editUrl: 'https://github.com/naver/jsdoc-to-mdx/edit/main/docs/docs/',        remarkPlugins: [require("remark-breaks")],      }    })  ]]