Morio | Morio
Morio is not ready for production|Learn more

Morio

Improving our documentation is one of the easiest ways to start contributing to Morio. So if you spot a mistake or see something that you can improve, please do not hesitate to do so.

This guide will show you how you can do that.

Making quick edits

The easiest way to make changes to the documentation is via the Edit this page link that you can find at the bottom of every documentation page.

This will take you to the GitHub online editor where you can propose changes directly.

Note: You need a GitHub account to do this, but they are free.

Where to find our documentation

We store our documentation as Markdown (nay MDX) in git and use Docusaurus to generate a static website from it, which we then publish at morio.it.

Inside our monorepo, the docs folder holds the docusaurus setup. Within that folder, the docs subfolder holds the actual markdown/mdx content.

So, relative to the monorepo root, you can find the source of our documentation under docs/docs.

Folder structure & file names

The folder structure of the markdown files directly translates to the URL structure of the documentation website. The file names must always be readme.mdx.

If we take this documentation guide as an example:

  • Relative url: /docs/guides/contributors/docs
  • Path to the source file: docs/docs/guides/contributors/docs/readme.mdx

That not only makes it easy to find the source of any given page, it also has implications for how you should structure content:

  • All content files under docs/docs should be named readme.mdx
  • All folders under docs/docs should have a URL-friendly name, using only the characters a-z, 0-9, and -
  • Every folder should have a readme.mdx, no empty folders

Front matter

Front matter is metadata that sits at the top of a markdown file. Strictly speaking, it is not part of markdown, but rather a list of key/value pairs in YAML format that starts and ends with ---. Here’s an example:

md
---
title: Documentation Guide
---

Improving our documentation is one of the easiest ways to start contributing to
Morio. So if you spot a mistake or see something that you can improve, please
do not hesitate to do so.

Title

The title entry is mandatory. In other words, every documentation page must have its title set in front matter.

As in YAML, you do not have to wrap your title in quotes, unless when it holds characters that would trip up the YAML parser (like when your title itself includes quotations marks).

Supported front matter

For an overview of all supported front matter, see the Docusaurus documentation on front matter in docs

Tags

The front matter example above can be further extended to add tags to the page. Here is an example:

md
---
title: Documentation Guide
tags:
  - contributors
---

Improving our documentation is one of the easiest ways to start contributing to
Morio. So if you spot a mistake or see something that you can improve, please
do not hesitate to do so.

We have added the contributors tag to this page, marking it as a page that is relevant for Morio contributors.

Tags are a way to group pages together that cover the same topic or category. Docusaurus will automatically create an overview page of all documentation that is tagged with any given tag.

For example, the pages tagged with contributors can be found at /docs/tags/contributors. Docusaurus will also include the tags at the bottom of the page, and they link to their overview pages.

Tags are most useful as a carefully curated collection of pointers. To ensure that, all tags must be defined in the docs/docs/tags.yml file.

The file holds tags that can be defined as such (using our contributors tag as an example):

YAML
contributors:
  label: Contributors
  permalink: /docs/tags/contributors
  description: Documentation relevant for contributors

As you can see, you can explicitly set a label, permalink, and description. However, we just rely on the defaults, so you will define the tag and do not specify any properties. Here is how to do that in YAML:

YAML
contributors:

To add a tag, place it on a new line followed by :.

TIP

An overview of all tags is available at /docs/tags.

Keywords

Keywords are like tags but they are not centrally manages, and no pages are created to link together the pages with the same keywords.

Instead, their use is intended to enhance search results as Docusaurus will use them to populate the HTML meta tags of the page.

Here is an example:

md
---
title: Documentation Guide
keywords:
  - contributors
  - documentation
  - markdown
  - mdx
---

Custom components

Docusaurus supports MDX which is markdown with support for custom components. A number of MDX components are supported out of the box, like the tabs used on this page.

In addition, we provide some MDX components that you can use in documentation pages. They are listed below.

RepoFile

The RepoFile custom component allows you to create a link to a file in the monorepo. The link will point to the same file on Codeberg, specifically in the default develop branch.

markup
<RepoFile>/docs/guides/contributors/docs/readme.mdx</RepoFile>. ```
</Tab>
<Tab>
To see this example, check out <RepoFile>/docs/guides/contributors/docs/readme.mdx</RepoFile>.
</Tab>
</Tabs>

### WithCaption

The `WithCaption` custom component allows you to place a caption under any content.

<Tabs tabs="MDX, HTML">
<Tab>
```markup
<WithCaption caption="This allows you to put a caption under anything">
  ![Placeholder image](https://dummyimage.com/1200x400/3/a&text=It's-a%20me,%20Morio!)
</WithCaption>

Terminology

It is common in technical documentation to use terms or acronyms that the reader might not be familiar with. This can create a barrier to readers, especially when those terms are specific to Morio.

To address this, we have extended Docusaurus with two custom features that help you demystify this type of content: jargon and terminology.

Jargon vs Terminology

Both jargon and terminology can be anything that needs explaining. The difference is that jargon does not warrant or require its own dedicated documentation page.

Terminology

Creating a terminology page

To create a new terminology page, create a folder under /docs/docs/reference/terminology.
The name of the folder should follow the same rules as any folders under docs/docs: use only the characters a-z, 0-9, and -.

Then, add a readme.mdx file to the folder as you would for any documentation page.

Terminology properties

Terminology terms have the following properties that are set in front matter and control how they are rendered on the page:

  • title
    • description: The text used when displaying the terminology link
    • default: The front matter title value
  • term
    • description: The term that will trigger rendering the terminology link when emphasised
    • default: The file’s lowercased basename with dashed replaced by spaces (core-service becomes core service)
    • custom: The front matter term value
  • aliases
    • description: A list of additional terms that will trigger rendering the terminology link when emphasised.
    • default: none
    • custom: The front matter aliases value (an array of strings)

Below is an example:

docs/docs/jargon/mdx.md
---
title: Core Service
aliases:
  - core
tags:
  - core
---

The **Morio Core Service** (core) sits at the root of any Morio deployment and is
responsible for [orchestration](#orchestration), [configuration
resolution](#configuration-resolution), and [clustering](#clustering).

To learn more, visit [the Core Service guide](/docs/guides/services/core).

Using a terminology term

Once you have created a terminology term, you can use it by emphasising the page title in your markdown content. This will turn the terminology term into a link that leads to the terminology page:

md
I want to learn more about _core_. Is it the same as the _core service_?

Will render as:

I want to learn more about core. Is it the same as the core service?

Terminology terms are case-insensitive

You can write core, CORE, or even cORe, they will all trigger rendering the core terminology link.

List of terminology pages

The following terminology pages are currently available for use in your markdown content:

Includes

Sometimes, you may find yourself repeating the same information on various documentation pages. You could create a page for it and link to it, but perhaps it’s more elegant to inline the information in the page.

In a case like this, you can use an include. This allows you import MDX content into your documentation page.

Creating an include page

To create an include page, add the page to the docs/includes folder in the monorepo.

Unlike the docs/docs folder where we rely on folder structure, all files should be in the same folder.

As such, you should give it a name that conveys the intent of the include. As a practical example, the difference between the built container images for the development environment and production is something that is relevant on various documentation pages.

So, the documentation is kept in the docs/includes/docker-env-diffs.mdx file.

Importing and using the include file

Once created, you can import the file as any other import in your readme.mdx:

mdx
---
title: Example of how to use an include
---

import DockerBuildEnvDiffs from 'site/includes/docker-env-diffs.mdx'

Some (optinoal) other content here.

<DockerBuildEnvDiffs />

A few things to note:

  • The import statement should be the first thing after the front matter
  • Use the site/includes/ prefix to import include files.
  • Since we are using the default export, the name you give it can by anything (here we used DockerBuildEndDiffs
  • This will be used as a React component, so you must pick a name that starts with a capital letter
  • Output the info as a React component: <DockerBuildEnvDiffs />

See docs/reference/contributors/monorepo/run-scripts/build-api/readme.mdx for an example.

Tips for writing great documentation

Here is some friendly advice to help you write great documentation:

Don’t use gen-AI

Writing yourself will make you a better writer.

No Gen-AI please

We take pride in the fact that all of Morio’s documentation is written by actual human beings.
Please respect that and don’t reach for ChatGPT or whatever the generative AI flavour of the day is.

Write now, edit later

Just write. Don’t worry about grammar or making mistakes. It’s fine.

It doesn’t have to be perfect, it just needs to be written down.

Anybody can edit to improve form or structure.

Use plain language

Explain things in simple words. Write short plain sentences. Use headings and paragraphs to structure your writing.

Get to the point

Say what you need to say — no more, no less.
Make your text as short as possible; your documentation will be better this way.

Use meaningful titles and hyperlinks

Page titles should be meaningful without context. They are the main result in search, so strive to make them meaningful and informative on their own.

That often means making your titles a lot longer, which doesn’t work well in the navigation sidebar. You can use the sidebar_label key in front matter to set a different title to use in the sidebar.:

To a lesser extend, the same advice applies to links:

Define jargon

Don’t use jargon without giving readers an easy way to learn about it.

More advice

The “Technical Writing From Google” course comes highly recommended.

Remember that the worst possible documentation is the documentation that is never written.

Running the documentation site locally

NOTE

We assume you have git and NodeJS installed.

To run a local instance of the documentation site — highly recommended if you’re looking to make non-trivial changes to the documentation — you can follow these steps:

Terminal
git clone git@github.com:certeu/morio.git
cd morio
npm install
cd docs
npm run start

In other words:

  • Clone the repository
  • Install dependencies
  • Run npm run start in the docs folder

The docs site will now be running on http://localhost:3000 and any changes you make will be hot-reloaded.

Untested on Windows

While we support Microsoft Windows as a platform for the Morio client, no Microsoft Windows is used in the development of Morio. If you are on Windows, your mileage may vary.

Redoc Integration

We generate our API reference documentation by using redocusaurus which integrates redoc in docusaurus.

The configuration is part of docs/docusaurus.config.js and it adds these two routes:

<!-- Morio wordmark font is phosphate (with some tweaks -->by CERT-EU