Newton's Principia Mathematica

    TypeScript icon, indicating that this package has built-in type declarations

    0.2.0 • Public • Published


    build status dependency status npm version

    This is a command-line tool to generate API documentation for TypeScript projects based on information about types and exported declarations extracted using readts. Run docts inside your package and it parses the .d.ts files referenced from the typings key of your package.json. Then it replaces any section titled API in your file with new automatically generated content. For an example of its output, see the API section below.

    If your package is a Git working tree and the repository field in package.json points to a Github URL, links to relevant parts of the code published on Github are added next to functions, classes and methods. Each link looks like <> and includes the hash of the latest commit which changed the relevant file. If that file is dirty in the working tree, the link points to whatever is on the current branch instead. This minimizes changes to the links while trying to keep them pointed to the correct location in latest code.

    Any additional TypeScript configuration should be defined in tsconfig.json in the root if your package.


    Start by making a backup of your

    Then install:

    npm install --save-dev docts

    Make sure your package.json has a typings section and add in the scripts section:

        "docts": "docts"

    Finally run:

    npm run docts


    Docs generated using docts

    Class DocBuilder

    TypeScript project Markdown documentation builder.
    Source code: <>


    new( ) DocBuilder <>
     ▪ basePath string
    .build( ) Promise<any> <>
    Generate API documentation for the package.
    Returns promise resolving to an array of text split by line breaks.

    Class Markdown

    Represents a Markdown file.
    Source code: <>


    new( ) Markdown <>
     ▪ markdownPath string
    .readSections( ) Section[] <>
    Read the file and split each heading into a separate section.
    .writeSections( ) Promise<void> <>
    Replace file contents with a new list of sections.
     ▪ sectionList Section[]


    .path string

    Class Section

    Represents a section in a Markdown file.
    Source code: <>


    .header string[]
    Heading and its markup split by newlines.
    Heading is a line beginning with # or followed by another line full of - or =.
    .content string[]
    Section content split by newlines.
    .name string
    Heading with markup stripped.

    Function patchReadme

    Patch section titled API of file in given directory.
    Source code: <>

    patchReadme( ) void <>
     ▪ basePath string


    The MIT License

    Copyright (c) 2016 BusFaster Ltd




    npm i docts

    DownloadsWeekly Downloads






    Unpacked Size

    23.7 kB

    Total Files


    Last publish


    • jjrv