Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Documenting yaml [closed]

Is there something like javadoc or rdoc for documenting YAML files, so that we could extract it into HTML documentation? Ideally with markdown syntax.

like image 908
Mladen Jablanović Avatar asked Jul 05 '11 18:07

Mladen Jablanović


People also ask

What is YAML documentation?

YAML is a digestible data serialization language often used to create configuration files with any programming language. Designed for human interaction, YAML is a strict superset of JSON, another data serialization language.

What does the dash mean in YAML?

Items of a list in YAML are represented by preceding it with - (hyphen). Key value pairs in YAML are represented as <key>:<value> . YAML is case sensitive. YAML uses spaces and indentations to define document structure. To define a YAML file we use either .

Do blank lines matter in YAML?

In general the order of keys in a YAML file does not matter. Neither do blank lines. Indentation may be with any number of spaces, as long as it is consistent throughout the file.

How do I save a YAML file?

Developer can use remote URL to save and edit the YAML files. Here are few samples of the YAML URL. Now click on these YAML samples. Once this link is open, use save as functionality of the browser and save.


1 Answers

Overview

As it appears in the comments to the question, generally speaking, all that is necessary for documenting YAML is to create a section of the YAML content devoted specifically to documentation or metadata.

The only noteworthy challenge is determining whether you want your documentation section to conform with the conventions of any of the various syntax-styles for documenting code (e.g., Doxygen, NaturalDocs, whatever).

There are various approaches to this problem domain. Alternate approaches are indicated in the "See also" section of this answer.

Example

Creating a metadata section in YAML is very straightforward, you can do it simply by creating an inline string where you dump all your documentation as a single block.

  ## comments
  ## NOTE: YAML generally throws your comments away, so they are not very useful
  ## for round-trip metadata

  meta: | 
     Here is all my documentation and metadata
     blah blah blah.

  data: 
     branch_one: 
        - caption: blah blah
          date: blah blah
          details: blah blah

        - caption: blah two
          date: blah blah
          details: blah blah

     branch_two: 

  [..]

See also

  • https://blog.github.com/2013-09-27-viewing-yaml-metadata-in-your-documents/
  • Pandoc: Template with YAML metadata
  • How to specify YAML metadata in Markdown for Pandoc Beamer slides?
like image 82
dreftymac Avatar answered Oct 01 '22 12:10

dreftymac