gitbook-plugin-folding-menu

1.0.1 • Public • Published

gitbook-plugin-folding-menu

This gitbook plugin manages large left-nav menus by visualizing only one section at a time (the active section).

NPM Version Badge

At a Glance

Overview

The high-level points of interest are:

  • On initial display, only the top-level menu items are displayed.

  • Navigating to a section with sub-content will dynamically expand it, collapsing any prior section.

  • The active section will expose the entire sub-menu depth (i.e. all it's ancestry, not just direct children).

  • Navigating between sections continues to expand only the active section (expanding the active section while collapsing any section previously expanded).

  • Animation is used to make the user experience more intuitive (i.e. they can visually see what is happening)!

  • Sections that are composed of multiple pages are supported.

This plugin has the effect of "taming" a big unruly menu structure, by exposing only one section at a time, making it more intuitive for end-user consumption.

You can see this in action at: https://feature-u.js.org/ (one of my open source projects).

This project is a significant improvement on other similar plugins.

Install

  1. Add the "folding-menu" plugin to your book.json file:

    book.json

    {
      ...
      "plugins": [
        ... other plugins you may be using
        "folding-menu"
      ]
      ...
    }
  2. Install the plugin using one of the following options (based on your gitbook usage):

    • For https://legacy.gitbook.com/ usage, plugins are automatically installed.

    • For local gitbook usage run gitbook install to install and prepare all plugins for your books:

      gitbook install
    • For technical users (ex: open source documentation), install the plugin to your devDependencies as follows:

      npm install --save-dev gitbook-plugin-folding-menu

Configuration

You may optionally supply the following configuration to this plugin:

    book.json

    {
      ...
      "pluginsConfig": {
        "folding-menu": {
          "animationDuration": 500,
          "sticky":            true
        }
      }
      ...
    }
  • animationDuration - The animation duration in mills ... use 0 (zero) to disable animation ... DEFAULT: 400

  • sticky - Leave the last section expanded when a the current active section has NO sub-content ... DEFAULT: false

Revision History

Release What When
v1.0.1 Added Configuration September 8, 2018
v1.0.0 Initial Release September 7, 2018

v1.0.1 - Added Configuration (September 8, 2018)

v1.0.0 - Initial Release (September 7, 2018)

Package Sidebar

Install

npm i gitbook-plugin-folding-menu

Weekly Downloads

7

Version

1.0.1

License

MIT

Unpacked Size

16.7 kB

Total Files

5

Last publish

Collaborators

  • kevinast