Book Image

The Official Guide to Mermaid.js

By : Knut Sveidqvist, Ashish Jain
Book Image

The Official Guide to Mermaid.js

By: Knut Sveidqvist, Ashish Jain

Overview of this book

Mermaid is a JavaScript-based charting and diagramming tool that lets you represent diagrams using text and code, which simplifies the maintenance of complex diagrams. This is a great option for developers as they’re more familiar with code, rather than using special tools for generating diagrams. Besides, diagrams in code simplify maintenance and ensure that the code is supported by version control systems. In some cases, Mermaid makes refactoring support for name changes possible while also enabling team collaboration for review distribution and updates. Developers working with any system will be able to put their knowledge to work with this practical guide to using Mermaid for documentation. The book is also a great reference for looking up the syntax for specific diagrams when authoring diagrams. You’ll start by learning the importance of accurate and visual documentation. Next, the book introduces Mermaid and establishes how to use it to create effective documentation. By using different tools, editors, or a custom documentation platform, you’ll also understand how to use Mermaid syntax for various diagrams. Later chapters cover advanced configuration settings and theme options to manipulate your diagram as per your needs. By the end of this book, you’ll be well-versed with Mermaid diagrams and how they can be used in your workflows.
Table of Contents (19 chapters)
1
Section 1: Getting Started with Mermaid
7
Section 2: The Most Popular Diagrams
12
Section 3: Powerful Diagrams for the Advanced User

Setting up your custom documentation system that supports Mermaid using Gatsby

If you need a more versatile way of setting up a documentation system, you can use a static site generator. There are many static site generators to choose from. We have Hugo, Gatsby, Jekyll, Nuxt, and Hexo, to name a few.

A static site generator uses content data, applies this data to predefined templates, and then generates a finished view, which, for instance, could be an HTML file. We will be using Gatsby here as it is one of the most widely adopted static site generators and serves as a good example. This example will be easier to grasp if you have some prior basic knowledge of Node.js and npm, as we will be using these to install Gatsby.

With Gatsby, you can generate any kind of website, ranging from a complex, feature-rich interactive site all the way to a static site that only contains content. In order to get a starting point of the new site and ensure it matches what is intended, we can...