npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

webpack-plugin-markdown-jsdoc

v1.0.0

Published

> 基于 JSDoc 注释自动生成 Markdown 格式 API 文档的 Webpack 插件,支持函数/对象的多维度文档生成,完美适配现代前端工程化流程

Readme

webpack-plugin-markdown-jsdoc

基于 JSDoc 注释自动生成 Markdown 格式 API 文档的 Webpack 插件,支持函数/对象的多维度文档生成,完美适配现代前端工程化流程

✨ 功能特性

  1. 智能注释解析
    通过 @README 标记自动识别文档块,支持:
    • 参数类型声明 @param {type}
    • 返回值说明 @return {type}
    • 代码示例嵌入 @example
    • 自定义名称描述 @name
  2. 零配置开箱即用
    默认自动扫描 .js 文件,排除 node_modules 目录,输出标准化文档结构
  3. 灵活过滤机制
    // 支持正则表达式和字符串匹配
    include: ['src'],
    exclude: ['node_modules']
  4. ​工程化深度集成
    在 Webpack 构建流程的 transform 阶段解析代码,writeBundle 阶段生成最终文档

配置示例

配置参数

| 参数 | 类型 | 默认值 | 说明 | |------------|--------------------|----------------------|-------------------------------| | outputPath | string | ./dist/api-docs.md | 文档输出路径 | | exclude | Array<string/RegExp> | ['node_modules'] | 排除目录/文件的正则匹配规则 | | include | Array<string/RegExp> | [] | 包含目录/文件的正则匹配规则 |

配置示例

// webpack.config.js
const MarkdownJsdocPlugin = require('webpack-plugin-markdown-jsdoc');
const path = require('path');

module.exports = {
    entry: './test/index.js',
    output: {
        path: path.resolve(__dirname, './test/dist'),
        filename: 'bundle.js'
    },
    plugins: [
        new MarkdownJsdocPlugin({
            outputPath: './test/dist/api-docs.md',
            exclude: ['node_modules'],
        })
    ]
}

🧩 使用方法

代码注释规范

// index.js
/**
 * @README
 * @name fetchData 核心数据获取方法
 * @param {string} url API地址
 * @param {Object} config 请求配置
 * @return {Promise} 携带数据的Promise对象
 * @example fetchData('/api/user', { timeout: 5000 })
 */
export function fetchData(url, config) {
  // ...实现代码
}

输出文档示例

## fetchData
核心数据获取方法

### 参数列表
| 参数名 | 类型    | 描述       |
|--------|---------|------------|
| url    | `string` | API地址    |
| config | `Object` | 请求配置   |

### 返回值
- 类型:`Promise`
- 描述:携带数据的Promise对象

### 代码示例
```javascript
fetchData('/api/user', { timeout: 5000 })