V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
steins2628
V2EX  ›  Vue.js

vue-ts 文档生成工具有没有推荐的? typedoc 不太好用

  •  
  •   steins2628 · Jun 19, 2024 · 1961 views
    This topic created in 679 days ago, the information mentioned may be changed or developed.

    如题,vite 创建的 vue3 typescript 工程,注释什么的都写好了,想要用工具直接生成对应 md 文档文件。

    尝试过 typedoc ,对单一 .ts 文件支持不错,对 .vue 文件就不太行,即使加上了 typedoc-plugin-vue 插件也不太行,因为是用 <script setup> 写的,插件只支持 definecomponent 定义出来的组件。

    也想过写个脚本遍历工程,提取 <script> 标签下的内容写个临时的 .ts 文件,生成完文档直接删,但是 typedoc 好像命令行没有什么设置能一次仅处理一个文件。

    所以有没有什么好用的工具能直接生成对应文档的?求推荐

    # typedoc.json
    {
        "$schema": "https://typedoc.org/schema.json",
        "entryPoints": ["../src/App.vue"],
        "out": "./docs",
        "plugin": [
            "typedoc-plugin-vue",
            "typedoc-plugin-markdown"
        ]
    }
    
    # 项目结构示意
    # {project}
    - public
    - typedoc
      - docs
      - package.json
      - typedoc.json
    - src
      - components
        - Title
          - Title.vue
          - type.ts
      - router
        - index.ts
        - type.ts
      - store
        - index.ts
        - type.ts
      - views
        - Home
          - Home.vue
          - type.ts
        - Config
          - Config.vue
          - type.ts
      - App.vue
      - main.ts
      - types.ts
    - index.html
    - tsconfig.json
    - vite.config.ts
    - package.json
    
    3 replies    2024-06-19 22:04:00 +08:00
    hengshenyu
        1
    hengshenyu  
       Jun 19, 2024
    vue-component-meta
    rookie2luochao
        2
    rookie2luochao  
       Jun 19, 2024
    你可以试试 vite-plugin-dts 看看能不能达到你想要的效果
    rookie2luochao
        3
    rookie2luochao  
       Jun 19, 2024
    @rookie2luochao 看错了,不好意思,我以为生成 dts 呢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   960 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 69ms · UTC 19:54 · PVG 03:54 · LAX 12:54 · JFK 15:54
    ♥ Do have faith in what you're doing.