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

@dopro/docsmaker

v0.1.16

Published

文档生成工具

Readme

docsMaker 无感知文档生成器

document maker tool for vue and markdown.

所谓无感知,即在你不知不觉中已经把文档生成。

支持的功能

  • markdown解析
  • demo预览自动生成
  • vue组件代码自动生成
  • 文档目录自动生成

安装

  • node > 8.0
  • 安装模块
# 安装到全局,可通过命令行执行
tnpm install @dopro/docsmaker -g
# 安装到项目
tnpm install @dopro/docsmaker

配置

docsmaker适用于js项目,配置信息写入package.json文件里面的docs字段,示例以及配置说明如下,所有配置均非必填:

{
    ...
    "docs": {
        // 文档标题,默认为项目目录名
        "title":"文档生成工具",
        // 文档名字,当该项目为子项目时会作为目录,默认为项目目录名
        "name":"docsmaker",
        // 该项目下的文档所在目录,默认为['docs']
        "docs":["docsmaker"],
        // 该项目的主页,默认为"readme.md"
        "home":"readme.md",
        // 该项目所需要自动生成文档的vue组件目录,默认为[]
        "components":[],
        // 子项目的pattern,默认为""
        "subPatterns":"",
        // docsmaker使用vuepress构建文档,这里可以指定自定义的vuepress构建文件位置,默认为""
        "config":"",
        // 使用build模式生成的文档位置,默认为"docsmaker"
        "dest":"docs",
        "translate":{
            "components":"组件",
            "intro":"介绍",
            "example":"示例"
        }
    }
}

使用

命令行

# 调试模式
docsmaker
# 构建模式
docsmaker build

代码引用

const docsmaker = require("docsmaker");
// 调试模式
docsmaker.dev();
// 构建模式
docsmaker.build();
  • 调试模式下,docsmaker会自动启动文档web服务,可以在浏览器直接访问,修改docshomecomponents配置项所指定的文件会自动构建。
  • 构建模式下,会在dest配置项所指定目录下构建出文档静态文件,直接在该目录启动web服务即可访问静态的文档页面,可以用来部署到服务器。

markdown扩展功能

markdown中直接使用vue组件

支持components配置项所指定目录下的所有vue组件在markdown中直接使用,比如该项目下,components/docsmaker-button.vue组件代码为:

<template>
    <div class="ui-btn">{{text}}</div>
</template>
<script>
export default {
    props:{
        text:{
            // ["按钮","确定"]
            type:String,
            default:'按钮'
        }
    }
}
</script>

<style lang="scss" >
.ui-btn{
    width:60px;
    height:30px;
    line-height: 30px;
    font-size:14px;
    color:#000;
    text-align: center;
    border-radius: 6px;
    border:#bbb 1px solid;
    cursor: pointer;
    &:active{
        opacity: .5;
    }
}
</style>

在markdown中直接使用:

<docsmaker-button/>

效果如下:

demo预览功能

可以通过简单的格式,快速写好demo和代码的预览,并可以再codepen中预览 下面是markdown的写法

::: demo html
<p class="common-html">
    this is <span style="color: red;">common</span> html
</p>
<style>
.common-html {
    color: green;
}
</style>
:::

::: demo html

:::

还支持vue写法

::: demo vue
<template>
    <button @click="onClick">Click me!</button>
</template>

<script>
export default {
    methods: {
        onClick: () => { window.alert(1) },
    },
}
</script>

<style>
button {
    color: blue;
}
</style>
:::

效果如下

::: demo vue

:::

vue组件文档自动生成

使用vuese自动生成components配置项指定的目录下vue组件的说明文档,并将demo呈现出来,带有// ["status1","status2"]注释的props会把改属性所有状态的组件显示出来,如前面提到的组件会生成这个文档:components/docsmaker-button.vue

自动生成目录

文档目录下的一级目录会自动生成为顶部导航,二级以下目录会生成侧边导航,通过translate配置,可以将名字转换为中文,如本项目的文档目录为:

|- readme.md
|- intro
    |- readme.md
|- components
    |- docsmaker-button.md