<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joel Amos</title>
    <description>The latest articles on DEV Community by Joel Amos (@murzuqisah).</description>
    <link>https://dev.to/murzuqisah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2057951%2F09da7fe4-4ad6-4b05-b55d-fe30eb010109.jpeg</url>
      <title>DEV Community: Joel Amos</title>
      <link>https://dev.to/murzuqisah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/murzuqisah"/>
    <language>en</language>
    <item>
      <title>YAML: Yet Another Markup Language.</title>
      <dc:creator>Joel Amos</dc:creator>
      <pubDate>Fri, 13 Sep 2024 09:53:28 +0000</pubDate>
      <link>https://dev.to/murzuqisah/yaml-yet-another-markup-language-4f59</link>
      <guid>https://dev.to/murzuqisah/yaml-yet-another-markup-language-4f59</guid>
      <description>&lt;h2&gt;
  
  
  Is it a failed language?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;YAML&lt;/em&gt; (YAML Ain’t Markup Language) is a human-friendly data serialization language used across various programming languages. Developed by &lt;em&gt;Clark Evans&lt;/em&gt;, &lt;em&gt;Ingy döt Net&lt;/em&gt;, and &lt;em&gt;Oren Ben-Kiki&lt;/em&gt; in &lt;em&gt;2001&lt;/em&gt;, YAML is known for its readability and is commonly used for configuration files. Unlike &lt;em&gt;Extensible Markup Language (XML)&lt;/em&gt; , &lt;em&gt;YAML&lt;/em&gt; is designed for ease of human reading and writing, and it features a simpler syntax compared to Standard &lt;em&gt;Generalized Markup Language (SGML)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;YAML&lt;/em&gt; supports custom data types but fundamentally encodes scalars (strings, integers, and floats), lists, and associative arrays (maps, dictionaries, or hashes). It employs a colon-centered syntax for key-value pairs, an indentation style similar to &lt;em&gt;Python&lt;/em&gt;’s, escape sequences like those in &lt;em&gt;C&lt;/em&gt;, and whitespace handling inspired by &lt;em&gt;HTML&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;History&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;YAML&lt;/em&gt; emerged during an era dominated by markup languages such as &lt;em&gt;HTML, _XML&lt;/em&gt;, and &lt;em&gt;SGML&lt;/em&gt; . Its name is a recursive acronym meant to emphasize its focus on data serialization rather than markup.&lt;/p&gt;

&lt;p&gt;Since its inception, &lt;em&gt;YAML&lt;/em&gt; has seen several versions with added features and improvements, starting with the first beta, &lt;em&gt;YAML 1.0&lt;/em&gt; , released on January 29, 2004. This version aimed to create a more human-readable format compared to &lt;em&gt;XML&lt;/em&gt; and &lt;em&gt;JSON&lt;/em&gt; .&lt;/p&gt;

&lt;p&gt;Subsequent versions were released later on and they include:&lt;br&gt;
&lt;em&gt;YAML 1.1 - 18 January 2005&lt;/em&gt;&lt;br&gt;
This version introduced enhancements and clarifications to the original specification, focusing on improving the handling of data types and various data structures .&lt;br&gt;
&lt;em&gt;YAML 1.2.0 - 21 July 2009&lt;/em&gt;&lt;br&gt;
Closely aligning to JSON, this release simplified the format and aimed to eliminate some obscurity present in the earlier releases.&lt;/p&gt;

&lt;p&gt;Subsequent versions include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;em&gt;YAML 1.1&lt;/em&gt; - &lt;em&gt;January 18, 2005&lt;/em&gt;: Introduced enhancements and clarifications to improve data type handling and data structures.&lt;/li&gt;
&lt;li&gt;  &lt;em&gt;YAML 1.2.0&lt;/em&gt; - &lt;em&gt;July 21, 2009&lt;/em&gt;: Simplified the format and aligned closely with &lt;em&gt;JSON&lt;/em&gt; to reduce obscurity.&lt;/li&gt;
&lt;li&gt;  &lt;em&gt;YAML 1.2.1&lt;/em&gt; - &lt;em&gt;October 1, 2009&lt;/em&gt;: Made &lt;em&gt;YAML&lt;/em&gt; a superset of &lt;em&gt;JSON&lt;/em&gt;, ensuring compatibility with valid &lt;em&gt;JSON&lt;/em&gt; documents.&lt;/li&gt;
&lt;li&gt;  &lt;em&gt;YAML 1.2.2&lt;/em&gt; - October 1, 2021: Focused on refining &lt;em&gt;YAML&lt;/em&gt; while maintaining its core principles, enhancing usability, and expanding its capabilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;YAML&lt;/em&gt; has a simple syntax designed with readability in mind. The indentations in its syntax denote structures.&lt;br&gt;
Its key features include:&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Human-Readability&lt;/u&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Indentation represents nested structures, which visually declutters the script.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Data Types: &lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scalars: Represent simple values such as strings, numbers, and boolean.&lt;/li&gt;
&lt;li&gt;Sequences: Represent ordered lists (arrays). Commonly denoted by a dash ( - ) followed by a space.&lt;/li&gt;
&lt;li&gt;Mappings: Represent key-value pairs (dictionaries). They are denoted by a colon (:) followed by a space.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Complex structures&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nested Sequences and Mappings: &lt;em&gt;YAML&lt;/em&gt; supports nested structures, allowing complex data to be represented hierarchically.&lt;/li&gt;
&lt;li&gt;References: It allows the use of anchors (&amp;amp;) and aliases (*) to reuse and reference data within the same document.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Formatting Rules:&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Indentation: Relies on 2 to 4 spaces for nesting. &lt;em&gt;NB: Tabs are not allowed.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Line Breaks: For multiple-lined strings, &lt;em&gt;YAML&lt;/em&gt; provides various options like folded style ( &amp;lt; ) and literal style ( | ).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Comments:&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Denoted by a #, and can be placed on their own line or at the end of a line.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;File Extensions:&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Typically uses &lt;em&gt;.yaml&lt;/em&gt; or &lt;em&gt;.yml&lt;/em&gt; extensions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;Interoperability:&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;As a superset of JSON, YAML supports JSON documents, making integration with JSON easier.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An example of a &lt;em&gt;YAML&lt;/em&gt; syntax:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt; &lt;span class="c1"&gt;# Favorite movies&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Casablanca&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;North by Northwest&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;The Man Who Wasn't There&lt;/span&gt;

&lt;span class="nn"&gt;---&lt;/span&gt; &lt;span class="c1"&gt;# Shopping list&lt;/span&gt;
&lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;milk&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;pumpkin pie&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;eggs&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;juice&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="nn"&gt;---&lt;/span&gt; &lt;span class="c1"&gt;# Indented Block&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;John Smith&lt;/span&gt;
  &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;33&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt; &lt;span class="c1"&gt;# Inline Block&lt;/span&gt;
&lt;span class="pi"&gt;{&lt;/span&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;John Smith&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;age&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;33&lt;/span&gt;&lt;span class="pi"&gt;}&lt;/span&gt;

&lt;span class="nn"&gt;---&lt;/span&gt; &lt;span class="c1"&gt;#Strings&lt;/span&gt;
&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="s"&gt;Wrapped text&lt;/span&gt;
   &lt;span class="s"&gt;will be folded&lt;/span&gt;
   &lt;span class="s"&gt;into a single&lt;/span&gt;
   &lt;span class="s"&gt;paragraph&lt;/span&gt;

   &lt;span class="s"&gt;Blank lines denote&lt;/span&gt;
   &lt;span class="s"&gt;paragraph breaks&lt;/span&gt;

&lt;span class="s"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;example&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="s"&gt;HTML goes into YAML without modification&lt;/span&gt;
&lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;

        &lt;span class="s"&gt;&amp;lt;blockquote style="font: italic 1em serif"&amp;gt;&lt;/span&gt;
        &lt;span class="s"&gt;&amp;lt;p&amp;gt;"Three is always greater than two,&lt;/span&gt;
           &lt;span class="s"&gt;even for large values of two"&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="s"&gt;&amp;lt;p&amp;gt;--Author Unknown&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="s"&gt;&amp;lt;/blockquote&amp;gt;&lt;/span&gt;
&lt;span class="na"&gt;date&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2007-06-01&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Bearing in mind that &lt;em&gt;YAML&lt;/em&gt; is still used widely in build and testing production-level environments, it proves to be an essential tool for managing configurations and data interchange. Its readability and flexibility make it a popular choice for defining automation scripts in &lt;a href="https://www.ansible.com/" rel="noopener noreferrer"&gt;&lt;em&gt;Ansible&lt;/em&gt;&lt;/a&gt; , where it streamlines IT task automation. Similarly, YAML's role in &lt;a href="https://docs.github.com/en/actions/writing-workflows/about-workflows" rel="noopener noreferrer"&gt;Github Workflows&lt;/a&gt; facilitates the configuration of &lt;em&gt;CI/CD pipelines&lt;/em&gt;, making testing and deployments more efficient. The continued evolution and integration of &lt;em&gt;YAML&lt;/em&gt; in these critical areas underscore its ongoing relevance and effectiveness in simplifying complex workflows and configurations.&lt;br&gt;
For me, if it works, the it is not a failure. &lt;/p&gt;

</description>
      <category>development</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
