@microsoft/tsdoc vs typedoc vs jsdoc
Documentation Generation Tools Comparison
3 Years
@microsoft/tsdoctypedocjsdocSimilar Packages:
What's Documentation Generation Tools?

Documentation generation tools are essential for creating structured and easily navigable documentation from source code comments. These tools parse specially formatted comments in the code and generate HTML, Markdown, or other formats, making it easier for developers to understand and use libraries, frameworks, or applications. They help automate the documentation process, ensuring that it stays up-to-date with the codebase, and can include features like type inference, code examples, and customizable templates. Tools like jsdoc, typedoc, and @microsoft/tsdoc are popular choices, each with unique features and strengths.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
@microsoft/tsdoc5,153,012
4,8722.71 MB14410 months agoMIT
typedoc2,192,058
8,1942.14 MB38 days agoApache-2.0
jsdoc2,039,914
15,3001.53 MB452a year agoApache-2.0
Feature Comparison: @microsoft/tsdoc vs typedoc vs jsdoc

TypeScript Support

  • @microsoft/tsdoc:

    @microsoft/tsdoc is designed specifically for TypeScript, providing a framework for writing and parsing documentation comments that are type-aware. It helps enforce best practices in documentation for TypeScript projects.

  • typedoc:

    typedoc is built for TypeScript and fully utilizes its type system to generate documentation. It provides rich type information, including interfaces, classes, and generics, making it the best choice for TypeScript projects.

  • jsdoc:

    jsdoc supports TypeScript to some extent, especially with the use of the --typescript flag. However, its primary focus is on JavaScript, and it may not fully leverage TypeScript's type information without additional configuration.

Customization

  • @microsoft/tsdoc:

    @microsoft/tsdoc provides a structured approach to documentation but is not a documentation generator itself. It focuses on defining a standard for TSDoc comments, which can be implemented by other tools for customization.

  • typedoc:

    typedoc allows for some customization, particularly in the theming and layout of the generated documentation. However, it is more opinionated than JSDoc, focusing on type-driven documentation.

  • jsdoc:

    jsdoc offers extensive customization options, including the ability to create custom tags, templates, and themes. Its flexibility allows developers to tailor the documentation output to meet specific needs.

Output Formats

  • @microsoft/tsdoc:

    @microsoft/tsdoc does not generate output formats directly. Instead, it provides a specification for TSDoc comments, which can be implemented by other tools to produce HTML, Markdown, or other formats.

  • typedoc:

    typedoc primarily generates documentation in HTML format, with some support for Markdown. It focuses on creating a structured and navigable representation of TypeScript code.

  • jsdoc:

    jsdoc generates documentation in HTML, Markdown, and other formats. It is highly configurable, allowing developers to choose the output format that best suits their needs.

Community and Ecosystem

  • @microsoft/tsdoc:

    @microsoft/tsdoc is backed by Microsoft and has a growing community focused on improving TypeScript documentation standards. Its ecosystem is still developing, with tools and integrations emerging.

  • typedoc:

    typedoc has an active community of contributors and users, particularly within the TypeScript ecosystem. It is continually evolving, with new features and improvements being added regularly.

  • jsdoc:

    jsdoc has a large and established community with a rich ecosystem of plugins, themes, and tools. Its long history and widespread use make it a reliable choice for documentation generation.

Ease of Use: Code Examples

  • @microsoft/tsdoc:

    @microsoft/tsdoc provides a clear and structured way to write documentation comments, but it requires integration with a documentation generator to produce output. Example of TSDoc comment:

    /**
     * A simple calculator class.
     *
     * @remarks This class provides basic arithmetic operations.
     * @public
     */
    class Calculator {
      /**
       * Adds two numbers.
       *
       * @param a - The first number.
       * @param b - The second number.
       * @returns The sum of the two numbers.
       * @example
       * const calc = new Calculator();
       * const sum = calc.add(2, 3);
       * console.log(sum); // 5
       */
      add(a: number, b: number): number {
        return a + b;
      }
    }
    
  • typedoc:

    typedoc is straightforward to use for TypeScript developers, as it leverages TypeScript's type system. Example of TypeDoc comment:

    /**
     * A simple calculator class.
     *
     * @class
     * @classdesc This class provides basic arithmetic operations.
     * @example
     * const calc = new Calculator();
     * const sum = calc.add(2, 3);
     * console.log(sum); // 5
     */
    class Calculator {
      /**
       * Adds two numbers.
       *
       * @param a - The first number.
       * @param b - The second number.
       * @returns The sum of the two numbers.
       */
      add(a: number, b: number): number {
        return a + b;
      }
    }
    
  • jsdoc:

    jsdoc is easy to use, especially for those familiar with JavaScript. It uses a simple comment-based syntax to generate documentation. Example of JSDoc comment:

    /**
     * A simple calculator class.
     *
     * @class
     * @classdesc This class provides basic arithmetic operations.
     * @example
     * const calc = new Calculator();
     * const sum = calc.add(2, 3);
     * console.log(sum); // 5
     */
    class Calculator {
      /**
       * Adds two numbers.
       *
       * @param {number} a - The first number.
       * @param {number} b - The second number.
       * @returns {number} The sum of the two numbers.
       */
      add(a, b) {
        return a + b;
      }
    }
    
How to Choose: @microsoft/tsdoc vs typedoc vs jsdoc
  • @microsoft/tsdoc:

    Choose @microsoft/tsdoc if you are developing a TypeScript library and want to establish a standardized documentation format that integrates well with other tools. It is particularly useful for projects that prioritize consistency and interoperability in documentation.

  • typedoc:

    Choose typedoc if you are working on a TypeScript project and want to generate documentation that fully leverages TypeScript's type system. It produces detailed, type-aware documentation and is ideal for projects where type information is crucial for understanding the code.

  • jsdoc:

    Choose jsdoc if you need a versatile and widely-used documentation generator that works with both JavaScript and TypeScript. It offers extensive customization options, supports various output formats, and has a large ecosystem of plugins and themes.

README for @microsoft/tsdoc

@microsoft/tsdoc

This library is the reference implementation of a parser for the TSDoc syntax. Using this library is an easy way to ensure that your tool is 100% compatible with the standard.

What is TSDoc?

TSDoc is a proposal to standardize the doc comments used in TypeScript source files. It allows different tools to extract content from comments without getting confused by each other's syntax. The TSDoc notation looks pretty familiar:

export class Statistics {
  /**
   * Returns the average of two numbers.
   *
   * @remarks
   * This method is part of the {@link core-library#Statistics | Statistics subsystem}.
   *
   * @param x - The first input number
   * @param y - The second input number
   * @returns The arithmetic mean of `x` and `y`
   *
   * @beta
   */
  public static getAverage(x: number, y: number): number {
    return (x + y) / 2.0;
  }
}

Give it a try!

Check out the TSDoc Playground for a cool live demo of our parser!

API Usage

The api-demo folder on GitHub illustrates how to invoke the TSDoc parser.

A separate NPM package @microsoft/tsdoc-config is used for loading the tsdoc.json file.

Get involved

The TSDoc project is actively evolving. Please visit the website for the latest documentation, instructions for building/debugging the projects, and other resources:

https://tsdoc.org/