or run

npx @tessl/cli init
Log in

Version

Files

docs

cli.mdindex.mdprogrammatic-api.md
tile.json

task.mdevals/scenario-2/

API Documentation Generator

Build a simple API documentation generator that processes JavaScript files with JSDoc comments and outputs formatted markdown documentation.

Requirements

Your task is to create a Node.js script that:

  1. Takes JavaScript source files as input (from a src/ directory)
  2. Processes JSDoc comments from these files
  3. Generates a markdown documentation file (docs/API.md)
  4. The markdown output should be well-formatted with proper headings and structure

The system should handle:

  • Multiple JavaScript files in the source directory
  • Standard JSDoc annotations (@param, @returns, @description, etc.)
  • Automatic formatting of the output as markdown

Implementation

@generates

API

/**
 * Main function that generates documentation from source files
 *
 * @param {string} sourcePattern - Glob pattern for source files (e.g., "src/**/*.js")
 * @param {string} outputPath - Path where the markdown documentation should be written
 * @returns {Promise<void>}
 */
async function generateDocumentation(sourcePattern, outputPath) {
  // IMPLEMENTATION HERE
}

module.exports = { generateDocumentation };

Test Cases

  • Given a single JavaScript file with JSDoc comments, it generates markdown documentation @test
  • Given multiple JavaScript files, it combines them into a single documentation file @test
  • The generated markdown file is created at the specified output path @test

Dependencies { .dependencies }

jsdoc-to-markdown { .dependency }

Provides markdown generation from JSDoc annotations.