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 🙏

© 2026 – Pkg Stats / Ryan Hefner

gitbook-plugin-widget

v0.0.6

Published

Widget plugin for GitBook

Readme

GitBook Widget Plugin

This is a plugin for GitBook since version 2.3.0.

It integrates a inline frame widget into you book.

NPM

Usage

Add the plugin to the book setting book.json and set the required options.

Options

  • common - This specifies the widget to display on all pages of your book's. (Required, Array)
  • specific - This specifies the widget to display on a specific page of your book's. (Required, Array)
  • container - The Container is the display part of the widget. (Required)
    • parent - Specifies the parent element of the position where the container is displayed. (Required)
    • elem - Specify the element of the container. (Required)
    • attr - Specify attributes of container elements. (Required)
      • id - Specify the ID of the container element. (Required)
    • child - Specify the child element of the container.
      • elem - You can specify elements of child elements just like containers.
      • attr - You can specify attributes of child elements just like containers.
      • text - You can specify the text of the child element.
  • style - You can specify the style of the container.
    • text - The actual style can be specified in the text of the element.
  • iframe - Specifies an external web page to display in the container. (Required)
    • elem - Specify the element of the iframe. (Required)
    • attr - Specify attributes of iframe elements. (Required)
      • id - Specify the ID of the iframe element. (Required)
      • name - Specify the name of the iframe element. (Required)
  • form - Specify the form for sending data to external web page. (Required)
    • elem - Specify the element of the form. (Required)
    • attr - Specify attributes of form elements. (Required)
      • id - Specify the ID of the form element. (Required)
      • action - Specify the action of the form element. (Required)
      • method - Specify the method of the form element. (Required)
      • target - Specify the target of the form element. (Required)
    • child - Specify the data on the external web page as a child element of the form element.
      • elem - You can specify elements of child elements.
      • attr - You can specify attributes of child elements.
        • value - If the data to be sent in the form is text, it will be the value as it is. If the data you send in the form is an object, you can specify the following types:

          • type - You can specify localStorage and state and location. localStorage is used to send tokens like JWT. state is used to send specific context of gitbook. location is window.location;
          • path - Specify the path of localStorage or state value. For localStorage, specify Key name. For state, specify a specific path of the gitbook state object. For location, specify a specific path of the window.location object. If path is not specified, all objects are returned.

          e.g. Specify the location

          {
            "elem": "input",
            "attr": {
              "id": "location",
              "type": "hidden",
              "name": "location",
              "value": {
                "type": "location",
                "path": "pathname"
              }
            }
          }

          e.g. location object

          "location": {
            "href": "https://example.com/current.html",
            "ancestorOrigins": {},
            "origin": "https://example.com",
            "protocol": "https:",
            "host": "example.com",
            "hostname": "example.com",
            "port": "",
            "pathname": "/current.html",
            "search": "",
            "hash": ""
          }

          e.g. Specify the gitbook state

          {
            "elem": "input",
            "attr": {
              "id": "state",
              "type": "hidden",
              "name": "state",
              "value": {
                "type": "state",
                "path": "state.page"
              }
            }
          }

          e.g. gitbook state object

          "gitbook": {
            "state": {
              "page": {
                "title": "title",
                "level": "2.1.2",
                "depth": 2,
                "next": {
                  "title": "title",
                  "level": "2.1.3",
                  "depth": 2,
                  "path": "example.com/current.md",
                  "ref": "example.com/current.md",
                  "articles": []
                },
                "previous": {
                  "title": "prepage title",
                  "level": "2.1.1",
                  "depth": 2,
                  "path": "example.com/pre.md",
                  "ref": "example.com/pre.md",
                  "articles": []
                },
                "dir": "ltr"
              },
              "file": {
                "path": "example.com/current.md",
                "mtime": "2018-08-23T03:03:16.000Z",
                "type": "markdown"
              },
              "gitbook": {
                // Gitbook version etc.
              },
              "config": {
                // The contents set in book.js etc.
              },
              "basePath": "..",
              "book": {
                // Gitbook language etc.
              }
            }
          }
      • text - You can specify the text of the child element.

Example

{
  "plugins": [
    "widget"
  ],
  "pluginsConfig": {
    "widget": {
      "common": [{
        "container": {
          "parent": "body",
          "elem": "div",
          "attr": {
            "id": "contactWidget"
          }
        },
        "style": {
          "elem": "style",
          "text": "#widgetFrame { width:100%; height:500px; } #contactWidget { width:300px; height:200px; transition-duration: 1s; bottom: -140px; right: 0; position: fixed; } #contactWidget:hover { transform:translateY(-190px); }"
        },
        "iframe": {
          "elem": "iframe",
          "attr": {
            "id": "widgetFrame",
            "name": "widgetFrame",
            "frameBorder": "0",
            "scrolling": "no"
          }
        },
        "form": {
          "elem": "form",
          "attr": {
            "id": "widgetForm",
            "action": "https://example.com/form",
            "method": "POST",
            "target": "widgetFrame"
          },
          "child": [{
            "elem": "input",
            "attr": {
              "id": "access_token",
              "type": "hidden",
              "name": "access_token",
              "value": {
                "type": "localStorage",
                "path": "access_token"
              }
            }
          }, {
            "elem": "input",
            "attr": {
              "id": "state",
              "type": "hidden",
              "name": "state",
              "value": {
                "type": "state",
                "path": "state.page"
              }
            }
          }]
        }
      }]
    }
  }
}

Аfter configuring book.json, run gitbook install to install all added plugins.