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

gitbook-plugin-edit-link-plus

v0.1.1

Published

Gitbook plugin add "edit this page" link, and intelligent recognition to Github or Gitlab source repository.

Downloads

687

Readme

Welcome to gitbook-plugin-edit-link-plus 👋

npm:version npm:download npm:prerequisite github:documentation github:maintenance npm:license github:snodreams1006 website:snodreams1006.tech 微信公众号:雪之梦技术驿站-brightgreen.svg

Gitbook plugin add "edit this page" link, and intelligent recognition to Github or Gitlab source repository.

🏠 Homepage

Screenshot

edit-link-plus-use-preview.png

Usage

Step #1 - Update book.json file

  1. In you gitbook's book.json file, add edit-link-plus to plugins list.
  2. In pluginsConfig, Set base value which is base path to your github or gitlab or other code repo. Trailing slash is NOT required.
  3. By default link label will be "Edit This Page". You can change it using plugin config label.
  4. In pluginsConfig, Set defaultBase value which is set as default base path to your github or gitlab or other code repo. Trailing slash is also NOT required.

Here is simplest example :

{
    "plugins": ["edit-link-plus"],
    "pluginsConfig": {
        "edit-link-plus": {
            "base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book"
        }
    }
}

In addition, the supported configuration options are as follows :

"base": {
  "type": [
    "string",
    "object"
  ],
  "title": "Base for the edit redirection",
  "required": true
},
"defaultBase": {
  "type": "string",
  "title": "Default base for the edit redirection",
  "required": false
},
"label": {
  "type": [
    "string",
    "object"
  ],
  "title": "Label for the edit button",
  "default": "Edit This Page",
  "required": false
}

Step #2 - gitbook commands

  1. Run gitbook install. It will automatically install edit-link-plus gitbook plugin for your book. This is needed only once.
gitbook install

or you can run npm install gitbook-plugin-edit-link-plus to install locally.

npm install gitbook-plugin-edit-link-plus
  1. Build your book (gitbook build) or serve (gitbook serve) as usual.
gitbook serve

Example

  • Official documentation configuration file

https://github.com/snowdreams1006/gitbook-plugin-edit-link-plus/blob/master/docs/book.json

{
    "plugins": ["edit-link-plus"],
    "pluginsConfig": {
        "edit-link-plus": {
            "base": {
              "snowdreams1006.github.io":"https://github.com/snowdreams1006/gitbook-plugin-edit-link-plus/edit/master/docs",
              "snowdreams1006.gitlab.io":"https://gitlab.com/snowdreams1006/gitbook-plugin-edit-link-plus/edit/master/docs",
              "snowdreams1006.gitee.io":"https://gitee.com/snowdreams1006/gitbook-plugin-edit-link-plus/edit/master/docs"
            },
            "defaultBase": "https://github.com/snowdreams1006/gitbook-plugin-edit-link-plus/edit/master/docs",
            "label": "Edit This Page"
        }
    }
}
  • Official example configuration file

https://github.com/snowdreams1006/gitbook-plugin-edit-link-plus/blob/master/example/book.json

{
    "plugins": ["edit-link-plus"],
    "pluginsConfig": {
        "edit-link-plus": {
            "base": "https://github.com/snowdreams1006/gitbook-plugin-edit-link-plus/edit/master/example"
        }
    }
}

Sample book.json file

{
    "plugins": ["edit-link-plus"],
    "pluginsConfig": {
        "edit-link-plus": {
            "base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book"
        }
    }
}

or you can add label to custom your label:

{
    "plugins": ["edit-link-plus"],
    "pluginsConfig": {
        "edit-link-plus": {
            "base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book",
            "label": "点我反馈"
        }
    }
}

Sample book.json file for Multi-source base

{
    "plugins": ["edit-link-plus"],
    "pluginsConfig": {
        "edit-link-plus": {
            "base": {
              "USER.github.io":"https://github.com/USER/REPO/edit/BRANCH/path/to/book",
              "USER.gitlab.io":"https://gitlab.com/USER/REPO/edit/BRANCH/path/to/book",
              "USER.gitee.io":"https://gitee.com/USER/REPO/edit/BRANCH/path/to/book",
              "CUSTOME DOMAIN":"https://github.com/snowdreams1006/gitbook-plugin-edit-link-plus/edit/master/docs"
            },
            "defaultBase": "https://github.com/USER/REPO/edit/BRANCH/path/to/book",
            "label": "Edit This Page"
        }
    }
}

Sample book.json file for multilingual labels

{
    "plugins": ["edit-link-plus"],
    "pluginsConfig": {
        "edit-link-plus": {
            "base": "https://github.com/USER/REPO/edit/BRANCH/path/to/book",
            "label": {
                "en": "Edit This Page",
                "zh": "编辑本页"
            }
        }
    }
}

Note: Above snippet can be used as complete book.json file, if your book doesn't have one yet.

Github/Gitlab: In string ...REPO/edit/BRANCH..., you may replace edit with tree if you want source file to open in read-mode, rather than edit-mode directly on github/gitlab.

Author

👤 snowdreams1006

Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a Star if this project helped you!

Copyright

Copyright © 2019 snowdreams1006.

This project is MIT licensed.

Thanks

Troubleshooting

  1. If you are not seeing the "Edit this page" link, check if your book.json is valid. You can use this online tool - http://json.parser.online.fr/beta/
  2. Check if you are using default gitbook theme. It is NOT recommended to modify gitbook themes directly.