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

vuepress-plugin-beautiful-bar

v1.0.4

Published

a plugin for vuepress to generate navbar and sidebar automatically

Downloads

7

Readme

Vuepress Plugin Beautiful Bar

Currently testing passed in node version 10.15.1

Documentations Here

github

gitee

Usage

Suppose our file structure is as follows

tree docs

docs
├── demo.md
├── nodejs
│   ├── README.md
│   └── vue
│       ├── README.md
│       └── vuepress
│           └── README.md
└── README.md

All you need to do is to config themeConfig.nav at .vuepress/config.js, and add beautiful-bar into plugins

// .vuepress/config.js
module.exports = {
  themeConfig: {
    nav: [
      { text: 'demo', link: '/demo'},
      {
        text: 'contact',
        items: [
          { text: 'Github', link: 'https://github.com/xiaminghu/vuepress-plugin-beautiful-bar' }
          { text: 'Gitee', link: 'https://gitee.com/xiaminghu/vuepress-plugin-beautiful-bar' }
          { text: 'Npm', link: 'https://www.npmjs.com/package/vuepress-plugin-beautiful-bar' }
        ]
      }
      {
        text: 'NodeJS',
        items: [
          { text: 'vue', link: '/platform/vue/' },
        ]
      }
    ]
  },
  plugins: [
    'beautiful-bar'
  ]
}

and beautifulBar will generate corresponding sidebar for you automatically

{
  "/nodejs/": [
    "",
    {
      "title": "vue",
      "collapsable": true,
      "sidebarDepth": 2,
      "children": [
        "vue/",
        {
          "title": "vuepress",
          "collapsable": true,
          "sidebarDepth": 2,
          "children": ["vue/vuepress/"]
        }
      ]
    }
  ]
}

Options

in most cases you don't need to edit those configs in config.js, but if there's some bug with these functions and I'm not able to update the package timely, it would be a good choice to modify those functions.

Github and Gitee has some error parsing the following table when I use a symbol | in this way: /img|image|src/g, while npm and vuepress have no such problem. In order to display it correctly in Github and Gitee, I need to escape the | with \, which may look strange in Npm and Vuepress. If so, please just ignore it.

| key | default | description | | :------------: | :------------------: | :-----------------------------------------: | | exclude | /img\|image\|src/g | RegExp of excluded directories | | readmeFirst | true | place README.md at the top of sidebar | | saveSidebar | false | whether to save generated sidebar data | | sidebarRelPath | sidebar.json | the default path where sidebar is generated |

Sorting

you could add a beautiful-bar config file to enable sorting function, the config file should be a js file currently, approximately looks like this:

module.exports = {
  sort: {
    recursive: false,
    sortBy: 'customOrder',
    order: ['nodejs.md', 'python.md', 'cpp.md'],
    customMethod: (arry) => {},
  },
}

sortBy option could be Name, customOrder, customMethod currently, and you'd find it's examples in my repository, github and gitee. here i handles process the value you input (inputValue.replace(/[^\w]/g, '').lower()),
in concern of different coding style, you could input custom_order, CustomOrder, custom order, and even c%U\/s#T$o-mO r*d^e~r is ok, though i guess you won't do that.

when you sortBy Name, it just sort according to its filename

when you sortBy customOrder, it only take effect in current directory, the option recursive won't take effect, and you can control the order of this directory directly using option order. Besides, please input the fullname of the file or directory, though it could be judged by fs module, it would take redundant consumption.

when you sortBy customMethod, you could use your own sorting method, and don't worry if your code raise an error, cause beautiful bar will catch it and tell you some infomation to help you handle with it.

the option recursive is used for applying your sorting method recursively, there would be two kind of situations:

  • using parent config:
    • if parent config has recursive: true and current config fail to load
  • using current config:
    • if parent config is unable to applied recursively such as customOrder
    • if you have a .beautiful-bar.js config file in your current directory