Skip to content

generate markdown-based documentation from typescript types ๐Ÿ“š

License

Notifications You must be signed in to change notification settings

hyper-level-nerds/ts-bookshelf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

34 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation


๐Ÿ“š
ts-bookshelf

npm MIT License Codecov branch
generate markdown-based documentation from typescript types

Introduction

ts-bookshelf is a library for generating markdown documentation from typescript types.

Installation

$ npm install ts-bookshelf

# or

$ yarn add ts-bookshelf

and you should install and import reflect-metadata and configure related things in your project:

$ npm install reflect-metadata

# or

$ yarn add reflect-metadata
import "reflect-metadata";
// in your tsconfig.json
{
    compilerOptions: {
        emitDecoratorMetadata: true,
        experimentalDecorators: true,
    },
}

Usage

import "reflect-metadata";
import { DocField, DocType, generateDocsForClass } from "ts-bookshelf";
import * as fs from "fs";

@DocType({
    name: "MyType",
    description: "this is a description of my type",
})
class MyType {
    @DocField({
        description: "this is a description",
    })
    public myProperty!: string;
}

// ...

const content = generateDocsForClass(MyType);
fs.writeFileSync("docs-for-MyType.md", content);

then docs-for-MyType.md will be:

# MyType (MyType)

this is a description of my type

## Fields

### `myProperty`

| Name        | Description           |
| ----------- | --------------------- |
| Type        | String                |
| Nullable    | โŒ No                 |
| Description | this is a description |

About

generate markdown-based documentation from typescript types ๐Ÿ“š

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published