Yamdog – Documentation Generator for JavaScript Modules

Years ago I used JSDoc to generate API docs – application programming interface documentation – for my JavaScript packages. Gradually I dropped the tool. I did not like how its syntax made the comment blocks look like another kind of code. Here is an example copied from JSDoc’s Getting Started guide:

/**
 * Represents a book.
 * @constructor
 * @param {string} title - The title of the book.
 * @param {string} author - The author of the book.
 */
function Book(title, author) {
}

Soon, I began writing my documenting comments in another, simpler way. That eventually led me to publish YamdogYet Another Markdown API Docs Generator for JavaScript. Here is the same example written in yamdog syntax:

// library.shelf.Book(title, author)
//
// Represents a book.
//
// Parameters:
//   title
//     string. The title of the book.
//   author
//     string. The author of the book.
//
function Book(title, author) {
}

In contrast to JSDoc, Yamdog has no predefined keywords or tags. The structure is all that matters. For that, it recognises popular Markdown and YAML syntax. YAML provides nested, indentation-based list structures. In turn, Markdown offers further structures like images, tables, and hyperlinks, and rudimentary markup for emphasis like italics and bolding.

For example, here is some Markdown:

# Heading

A paragraph with **bold** and *italic* words
and a [hyperlink](http://www.example.com).

![An image](http://www.example.com/image.jpg)

And here is some YAML:

This is:
- a list in YAML
- a list with two list items

And here we have:
  some key:     some value
  another key:  another value

In addition to mere syntax, Yamdog is a tool that you need to run to generate a documentation for your JavaScript code. See Yamdog Usage for details. The output looks similar to the screenshot below, taken from Yamdog’s own API docs that are generated with Yamdog itself of course.

Image: How the finished documentation looks like. Generated with Yamdog v1.2.1.

Soon after I published the yamdog package in July 2022, I began integrating it to multiple projects that screamed for better API reference docs, including Nudged, Affineplane, and Tapspace.

If you feel Yamdog could help you out in your documenting endeavours, travel to Yamdog homepage and give it a spin. If you face any issues or have ideas for improvement, let me know!

Akseli Palén
Hi! I am a creative full-stack web developer and entrepreneur with strong focus on building open source packages for JavaScript community and helping people at StackOverflow. I studied information technology at Tampere University and graduated with distinction in 2016. I wish to make it easier for people to communicate because it is the only thing that makes us one.

1 Comment

Leave a Comment

Your email address will not be published.