V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
ruoxie
V2EX  ›  分享创造

一个 typescript 转 markdown table 的工具

  •  
  •   ruoxie ·
    wjkang · 2021-09-09 11:34:12 +08:00 · 1486 次点击
    这是一个创建于 931 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://wjkang.github.io/typescript-to-markdown/

    typescript 类型转为 markdown table,可提取 jsdoc 注释,支持深层嵌套,支持自定义模板。

    例子:

    复制一段 typescript 类型声明,如下:

    interface User {
    /**
    * @description 用户 id
    * @type {number}
    */
    id: number;
    /**
    * @description 昵称
    * @type {string}
    */
    nickname: string;
    // 真实姓名
    trueName: string;
    // 年龄
    age: string;
    }
    
    

    类型声明转为 markdown table 的格式,如下:

    User

    参数 说明 类型 必须
    id 用户 id number
    nickname 昵称 string
    trueName 真实姓名 string
    age 年龄 string

    使用场景:在基于 typescript 开发库的时候,更加方便的生成文档

    2 条回复    2021-09-14 10:01:22 +08:00
    duTop
        1
    duTop  
       2021-09-10 11:15:04 +08:00
    赞,有用
    461229187
        2
    461229187  
       2021-09-14 10:01:22 +08:00
    推出 vscode 插件必装
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1531 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 17:09 · PVG 01:09 · LAX 10:09 · JFK 13:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.