YMAL Crash Course

Context : YAML, short for “YAML Ain’t Markup Language,” has become the go-to format for writing clean, readable configuration files in modern development workflows. In this blog, we’ll explore the essential concepts of YAML — from its indentation-b...

the_OldSchool_coder
YMAL Crash Course
  1. Context :

YAML, short for “YAML Ain’t Markup Language,” has become the go-to format for writing clean, readable configuration files in modern development workflows. In this blog, we’ll explore the essential concepts of YAML — from its indentation-based syntax and data types to powerful features like anchors, aliases, and multi-line strings. Whether you're working with Docker, Kubernetes, GitHub Actions, or any DevOps tool, mastering YAML is a must. This guide is perfect for beginners and a great refresher for experienced developers looking to write more efficient and maintainable config files.


  1. YAML is used in tools like:

  • GitHub Actions

  • Docker Compose

  • Kubernetes (K8s)

  • Ansible

  • CI/CD pipelines


  1. Hands On:

# Basic syntax for YAML
name: "Ayush"
age: 27

# List (We have to make list with 1 tab)
languages:
  - JavaScript
  - Python
  - Go

# Dictionaries (List of users with name and role)
users:
  - name: AyushMon
    role: Admin

  - name: BiscuitMon
    role: user

# Data types: string, number, boolean, null
title: "yaml basics"
version: 1.0
active: true
description: null

# Multi-line (preserves newlines)
block: |
  this is 
  multiple line 
  code that we can use for multi-line purpose

# Folded style (converts to single line)
folded: >
  this is 
  single line 
  code that we can use for multi-line to single-line purpose

YMAL is space sensitive language. So let’s understand the basic syntax of it. In YMAL we write code like key: pair. see the Space in the sample snippet of the code.

In YMAL file We can make :

  1. Basic key value pair

  2. Lists

  3. Nested Lists ( dictionary)


  1. Important Jargons :

  • Indentation:

    For making the List , We have to use Indentation. Means “1 tab”. For making list that is Important. Example: name and age…

  • List:

    For making the list We use Indentation (1 tab) and then have to write - to make it. Example : Language

  • Nested list :

    It’s the combination of lists. In the List you want to make another list then Like make a list normal list ( “ indentation ” +” - ” ). In That to write any Property we have to use 2 indentation ( 2 tabs ). Example ; role.

  • Multiple and single line :

    1. Multiple line are we written with “ | “ + after enter + 1 indentation + then multiple lines.

    2. For single/folded line use “ > “ and rest of things are same.


Conclusion :

YAML is a simple yet powerful format essential for clean and readable configuration across modern development tools.

CTA: ⭐ Star this repo and try writing your own YAML files — it's easier than you think!