V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
ruoxie

一个 typescript 转 markdown table 的工具

  •  
  •   ruoxie ·
    wjkang · Sep 9, 2021 · 2358 views
    This topic created in 1702 days ago, the information mentioned may be changed or developed.

    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 replies    2021-09-14 10:01:22 +08:00
    duTop
        1
    duTop  
       Sep 10, 2021
    赞,有用
    461229187
        2
    461229187  
       Sep 14, 2021
    推出 vscode 插件必装
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3426 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 11:07 · PVG 19:07 · LAX 04:07 · JFK 07:07
    ♥ Do have faith in what you're doing.