or run

npx @tessl/cli init
Log in

Version

Files

docs

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

task.mdevals/scenario-3/

Documentation Cross-Platform Generator

Build a tool that generates API documentation from JSDoc-annotated JavaScript source code with platform-specific line ending requirements.

Background

Your team works on an open-source project where contributors use different operating systems. Documentation must be generated with consistent line endings for version control, and the output format needs to work across multiple markdown platforms (GitHub, npmjs.org, generic markdown viewers).

Requirements

Create a Node.js script that:

  1. Accepts configuration options to specify:

    • Input JavaScript file path(s) to document
    • Output file path for the generated documentation
    • Line ending style (either "posix" or "windows")
    • Whether to use GitHub-flavored markdown or generic markdown
  2. Generates markdown documentation from the input JavaScript files with the specified line ending format

  3. Writes the generated documentation to the output file

Test Cases

  • Given a JavaScript file with JSDoc comments, generates markdown documentation with POSIX line endings when the line ending style is "posix" @test

  • Given a JavaScript file with JSDoc comments, generates markdown documentation with Windows line endings when the line ending style is "windows" @test

  • Given a JavaScript file with JSDoc comments, generates generic markdown (non-GitHub-flavored) documentation when generic markdown is specified @test

Implementation

@generates

API

/**
 * Generates platform-specific API documentation from JSDoc-annotated JavaScript files.
 *
 * @param {Object} options - Configuration options
 * @param {string|string[]} options.files - Path(s) to JavaScript file(s) to document
 * @param {string} options.output - Path where the generated documentation will be saved
 * @param {string} options.lineEndings - Line ending style: "posix" or "windows"
 * @param {boolean} options.useGithubMarkdown - Whether to use GitHub-flavored markdown (true) or generic markdown (false)
 * @returns {Promise<void>}
 */
async function generateDocumentation(options) {
  // IMPLEMENTATION HERE
}

module.exports = { generateDocumentation };

Dependencies { .dependencies }

jsdoc-to-markdown { .dependency }

Provides markdown documentation generation from JSDoc annotations.