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

0.1.1 • Public • Published

ts-gendoc

get info from TypeScript type declaration and generate document

import { Analyzer, genMarkdown } from 'ts-gendoc'
 
const filename = "/root/myfile.ts"    // absolute path
const symbolName = "SystemOptions"    // is exported interface or type
 
const analyzer = Analyzer.fromPaths([filename])
const symbol = analyzer.getSymbolFromFile(filename, symbolName)
const info = analyzer.getInfoOfSymbol(symbol)
const markdown = genMarkdown(info)
 
console.log(markdown)

JSDoc marks

You may use @gendoc flag1, flag2 in your jsdoc comment. Supported flags:

  • no-children: do not print Object's children (the nested list)
  • hidden: do not print this field in document

for example, in your ts file:

interface Options {
  /**
   * server path
   * 
   * @example foobar://foobar.com:1234/
   */
  server: string
 
  username: string   // your foobar username
  token: string      // your foobar token
 
  /**
   * this is classified. not in document
   * 
   * @gendoc hidden
   */
  mode: string
}

API

  • TO BE DONE

Package Sidebar

Install

npm i ts-gendoc

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

18.8 kB

Total Files

13

Last publish

Collaborators

  • lyonbot
  • vvdennisjames