How do I turn simple TypeScript types into a markdown table?

Viewed 347

I'm writing docs for a library and would like to find a way to turn my `props` into a simple markdown table. Every example I've seen so far feels too complex, and creates a whole docs website for me. I just want to loop over some files that have types and turn them into tables.

Is there a way to turn this:

type Props = {
  /*
   * this is a required color!
   */
  color: string
}

into this:

| Prop  | description  | type  | Required  |
|---|---|---|---|
|  color | this is a required color!  | string  | yes |

...which looks like this when printed from markdown: Example markdown table

Thank you!

0 Answers
Related