1. gitbook-plugin
Sample plugin for GitBook
gitbook-plugin
Package: gitbook-plugin
Created by: GitbookIO
Last modified: Sat, 18 Jun 2022 08:39:14 GMT
Version: 0.0.2
License: Apache 2
Downloads: 247
Repository: https://github.com/GitbookIO/gitbook-plugin

Install

npm install gitbook-plugin
yarn add gitbook-plugin

GitBook Sample Plugin

This is a sample plugin for GitBook.

Install it using: $ npm install gitbook-plugin

How GitBook plugin works?

A plugin for GitBook is a node package that can be published on NPM.

package.json

name

The package name should begin with gitbook-plugin-. And if your plugin is a theme, it should begin with gitbook-theme-.

Examples: gitbook-plugin-mixpanel, gitbook-plugin-googleanalytics, gitbook-theme-dark

engine

The package.json should contain a engine field using the standard norm.

"engines": {
    "gitbook": "*"
}

For example if you want your plugin to supports only GitBook version supperior to 0.3.1:

"engines": {
    "gitbook": ">=0.3.1"
}

entry point

The plugin entry point should return an object with some metadata.

"book"

Type: Object
Default value: {}

"book.assets"

Type: String
Default value: null

Path to the assets folder to copy

"book.js"

Type: Array
Default value: []

List of javascript file to add to the html pages (relative to the assets fodler).

"book.css"

Type: Array
Default value: []

List of css file to add to the html pages (relative to the assets fodler).

"book.templates"

Type: Object
Default value: {}

Templates to override default templates, only use this option if you want to change entirely how the book is rendered.

This object is a map: "name" -> "file", with names:

  • "site": page for a file from the site format
  • "page": page for the page format

"hooks"

Type: Object
Default value: {}

Map of "name" -> Function that needs to be called during build process. With names:

  • "init": just after initialization, before generation
  • "finish": after generation and everuthing is finished

Each hook can return a promise.

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin