Skip to main content

How to write Docs

Writing docs is simply said as easy as creating mdx files (which is simply just Markdown with some extra features). To do make it easy to read and find information easily it is recommended to keep an easy to understand folder structure together in which the documents can be written. This guide mainly explains how the sidebars.js works and how to setup that folder structure.

To get a good understanding I would suggest looking at the documents that were written for this specific guide and it's sidebars.js. Below you can see that file.

// @ts-check

/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
about: [
{
type: 'doc',
id: 'intro',
label: "Introduction",
},
{
type: 'category',
label: 'Docusaurus',
link: {
type: 'generated-index',
},
collapsed: false,
items: [
'docusaurus/overview',
'docusaurus/add-new-site',
'docusaurus/write-docs',
],
}
]
};

module.exports = sidebars;

This file isn't that large and is easy to understand. There are multiple levels of documents but you read more about that here.

That's it! There are more advanced techniques for writing docs but I would suggest reading the Docusaurus documentation for that.

tip

Use the Auto Wrapping feature for Markdown that the VSCode plugin Rewrap gives. For writing these files the default settings were used. To turn it on bring up the command palate (press F1) and find Rewrap: Toggle Auto-Wrap for Current Document. That turns on autowrap, but you can also use the key combination Alt + Q (For Mac use Opt) to manually wrap lines at the specified maximum line width that is set in the VSCode settings. The default is 80.