Moving Config Docs From YAML to Markdown
Tags: documentation, yaml, markdown
Published: 2023-05-03 17:06:45

---
title: Moving Config Docs From YAML to Markdown
published: true
description: It's possible it wasn't the most efficient, but it got the job done.
tags: documentation, docs, yaml, markdown
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qohwgp7q909heeborhxw.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-04-19 18:12 +0000
---
Documenting configuration directly on the config file is great, right? Everything is right there. 

Ehh.

This could probably be repackaged.

## Why embark on this journey?

You can Ctrl + F (or Command + F) your way through the [file](https://github.com/camunda/zeebe/blob/main/dist/src/main/config/broker.yaml.template), but you have to know what you are looking for. 

You could argue an intuitive experience and naming strategy would work well in this situation, but that's a stretch, particularly when talking about advanced config. A great goal, but really difficult.

For first time users, you are likely going to walk through this template, uncommenting out the config you do want to use. You may take the opportunity to stop and read along the way, but I'm thinking reading nearly 1000 lines and trying to retain keywords for future changes is just not going to work for most people. 

So let's get this presented in another way to maximize visibility and gain some of that sweet SEO and searchability people are used to these days. You'll cover the use cases where people go back to the config template directly and get it backed into the docs. 

## YAML to HTML

From [this issue](https://github.com/camunda/camunda-platform-docs/pull/1865#issuecomment-1487673994) comment:

> The template YAML as-is was hard to consume. Nearly everything is commented with # (except flush?) I had to start by copying the file locally and removing the comments for it to be valid YAML.

> From there, I took the lazy(ish) approach and used https://github.com/ishswar/yaml-to-table, which didn't work without some changes. Instead of copying the descriptions, it added ipsum... ugh.

I found [this project](https://medium.com/@pranay.shah/yaml2table-178086166f32) that got me from YAML to HTML. It wasn't perfect since it didn't copy the descriptions, but I'm not above putting on some background noise (music, podcast, etc.) and copy and pasting my little heart out. 

## HTML to Markdown

Since our docs are in [Docusaurus](https://docusaurus.io/), I could have left the tables in HTML, but once they were in HTML the move to Markdown is pretty well supported by various free tools.

I used [TableConvert](https://tableconvert.com/) which takes a bunch of different formats. Just be careful with what you put into any tool! None of this info was sensitive or private.

## Wrap up

Could I have done this in a more streamlined or automated way? Likely. 

Will I invest the time to script this? Unlikely.

I view this as a one time project with how stable the templates are and how little things change regularly in this space. If we were often adding, removing, or deprecating this config, I would certainly be more motivated to get this automated to go from YAML to Markdown with as little touches as possible. 

Have you done something similar? Do you read or work with YAML often? How do you prefer to read documentation on YAML config?

---
Cover photo by <a href="https://unsplash.com/fr/@elevatebeer?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Elevate</a> on <a href="https://unsplash.com/photos/dI-aXC7DWpQ?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>