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 🙏

© 2024 – Pkg Stats / Ryan Hefner

books-cli

v1.0.21

Published

由于本人经常性的写一些文档,然后现有的很多插件版本各方面存在问题,甚至还有一些作者已经放弃维护了,所以决定自己写一个综合性的插件用来满足个人需求。

Downloads

150

Readme

为了节约空间而写的一个插件

npm npm

由于本人经常性的写一些文档,现有的很多插件版本各方面存在问题,甚至还有一些作者已经放弃维护了,所以决定自己写一个综合性的插件用来满足个人需求。

本插件只在 Windows 系统下进行测试,Linux 等其他环境不保证问题的存在!!!

本人环境【Windows 10 64bit,nodejs v8.11.3,gitbook 3】

前置条件

使用 npm root -g查看npm全局模块安装路径。

新建NODE_PATH环境变量。

将路径加入到NODE_PATH环境变量中。

全局安装相应模块。

npm install -g books-cli

国内用户请使用cnpm安装

npm install -g cnpm
cnpm install -g books-cli

编辑 book.json

{
  "author": "刘士",
  "plugins": [
    "-lunr",
    "-search",
    "-highlight",
    "-sharing",
    "books"
  ],
  "pluginsConfig": {
    "books": {
      "prism_themes": "prismjs/themes/prism-okaidia.css",
      "github_url": "https://liushilive.github.io/"
    },
    "theme-default": {
      "showLevel": true
    }
  }
}

运行 gitbook install.

数学公式使用

支持 KaTeX 已支持的全部符号。

  • 内联数学公式:

    $$\int_{-\infty}^\infty g(x) dx$$
    
    $$\fcolorbox{red}{aqua}{A}$$
    
    $$\textcolor{#228B22}{F=ma}$$
  • 块级数学公式:

    $$
    \def\arraystretch{1.5}
    \begin{array}{c|c:c}
      a & b & c \\ \hline
      d & e & f \\
      \hdashline
      g & h & i
    \end{array}
    $$

流程图使用

  • 支持 mermaid 以支持的流程图。

    ```mermaid
    graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;
    ```
  • 支持 PlantUML 以支持的流程图。

    需要安装 Graphviz 以生成所有图表类型

    @startuml@enduml 如果存在,将采用默认样式。

    否则采用 18 号字体,除非需要采用个性化配置,否则不加。

    ```puml
    @startuml
    
    Class Stage
    Class Timeout {
      +constructor:function(cfg)
      +timeout:function(ctx)
      +overdue:function(ctx)
      +stage: Stage
    }
    Stage <|-- Timeout
    
    @enduml
    ```

代码高亮支持

采用 prism 支持所有官方支持语言。

主题样式

  • 支持官方所有主题

    prismjs/themes/prism.css
    
    prismjs/themes/prism-coy.css
    
    prismjs/themes/prism-dark.css
    
    prismjs/themes/prism-funky.css
    
    prismjs/themes/prism-okaidia.css
    
    prismjs/themes/prism-solarizedlight.css
    
    prismjs/themes/prism-tomorrow.css
    
    prismjs/themes/prism-twilight.css
  • 配置

    "pluginsConfig": {
      "books": {
        "prism_themes": [
          "prismjs/themes/prism-okaidia.css"
        ]
      }
    }

添加 github url 图标

  • 配置

    "pluginsConfig": {
      "books": {
        "github_url": "https://liushilive.github.io/"
      }
    }

鼠标悬浮可见

用法:把要隐藏文本内容放在 {%s%}{%ends%} 之间。

{%s%}Hello World.{%ends%}

点击隐藏或显示片段

可以使用标签定义一个新的片段:(默认隐藏)

<!--sec data-title="点我隐藏答案" data-show=true ces-->
B
<!--endsec-->

<!--sec data-title="点我看分析" data-id="section2" data-show=false ces-->
CPU
<!--endsec-->

<!--sec data-title="点我看分析" ces-->
C
<!--endsec-->

本标签包含以下参数:

  • title:标题
  • show:是否初始隐藏

导入外部代码文件

@import "你的代码文件" {语言}

@import "你的代码文件"

如果没有指明相关语言,将默认根据文件后缀推断语言。