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

@smori1983/vuepress-plugin-flexsearch

v1.3.0

Published

VuePress plugin for FlexSearch using Japanese morphological analyzer (kuromoji).

Downloads

5

Readme

vuepress-plugin-flexsearch

Demo site

CHANGELOG

Overview

VuePress plugin for FlexSearch.

To integrate VuePress and FlexSearch, firstly I have learned the basics from below packages:

Unlike these packages, to focus on search for Japanese, this plugin is using kuromoji (Japanese morphological analyzer) via kuromojin.

Search data is created after applying n-gram to texts extracted by kuromoji. And so search query is also preprocessed by n-gram.

Config

.vuepress/config.js

module.exports = {

  plugins: [
    ['@smori1983/vuepress-plugin-flexsearch', {
      //searchHotKeys: ['s', '/'],
      //searchMaxSuggestions: 20,
      //searchPaths: null,
      //uiAlignRightFactor: 10,
      //excerptAroundLength: 100,
      //excerptHeadText: '... ',
      //excerptTailText: ' ...',
      //tokenizerType: 'kuromoji.default',
      //ngramSize: 3,
    }],
  ],

};

Some configs are same as default @vuepress/plugin-search.

searchHotKeys

  • Type: string[]
  • Default: ['s', '/']

Set to an empty array to disable this feature.

searchMaxSuggestions

  • Type: number
  • Default: 20

The maximum number of results for search.

searchPaths

  • Type: RegExp | RegExp[]
  • Default: null

Configure if you want to limit the searchable paths.

uiAlignRightFactor

  • Type: number
  • Default: 10

Condition to add class attribute of align-light to suggestions area, which will be added when the number of navbar menus is less than uiAlignRightFactor.

excerptAroundLength

  • Type: number
  • Default: 100

Define how many texts are shown around first matched text on the excerpt of the result.

excerptHeadText

  • Type: string
  • Default: '... '

Define text which is shown for abbreviation if preceding text is longer than excerptAroundLength on the excerpt of the result.

excerptTailText

  • Type: string
  • Default: ' ...'

Define text which is shown for abbreviation if succeeding text is longer than excerptAroundLength on the excerpt of the result.

tokenizerType

  • Type: string
  • Default: 'kuromoji.default'

ngramSize

  • Type: number
  • Default: 3

Predefined components

PluginFlexSearchForm

Provides search form you can set up on arbitrary markdown file.

Usage example:

# Search

<PluginFlexSearchForm/>

Dev server launch option

If env variable VUEPRESS_FLEXSEARCH is defined as disabled, the plugin does not create search data on ready() callback.

It will be helpful if there are too many pages and so it takes long time to launch.

Example:

{
  "scripts": {
    "dev": "vuepress dev docs",
    "dev:light": "VUEPRESS_FLEXSEARCH=disabled vuepress dev docs",
    "build": "vuepress build docs"
  }
}

For Windows, you can configure with cross-env:

{
  "scripts": {
    "dev": "vuepress dev docs",
    "dev:light": "cross-env VUEPRESS_FLEXSEARCH=disabled vuepress dev docs",
    "build": "vuepress build docs"
  }
}