Search code examples
yamlmarkup

If YAML ain't markup language, what is it?


I fail to see what makes YAML any less of a markup language than XML. The purpose of a markup language is to define the structure of a document, and YAML does exactly that (YAML stands for YAML ain't markup language).

What YAML should instead stand for is, Yet another markup language.


Solution

  • So, a markup language presumes a base text, typically human readable, and then special indicators or "markup" which direct processing. The idea comes from an editor, who would take a printed-version of someone's manuscript, and "mark it up" to show where new lines should go, edits, etc.

    In this manner, SGML is a meta-language for declaring markup languages, and HTML is a markup language. In 1996-7, when XML came on the scene, it was sold as a simplified SGML meta-language for creating markup languages. In XML (and SGML), you have elements to "mark" a portion of text, and then attributes that modify the marking. Over time, XML was used for much more than document markup though, people used it for data serialization -- even though it was never designed to do such a thing. Of course, it was the big problem to be solved.

    YAML and JSON appeared on the scene and focused on data serialization, not document markup. In these languages, there simply isn't a core document text.
    Hence, YAML Ain't Markup Language is quite an accurate differentiator from XML.