1.0.0 • Published 2 years ago

vuepress-plugin-flexsearch-td v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

vuepress-plugin-flexsearch-td

本项目在vuepress-plugin-flexsearch-pro的基础上进行修改。可以替换vuepress自带的搜索控件,支持单个vuepress站点的国际化搜索(针对不同语言进行全文搜索)。

安装

yarn add -D vuepress-plugin-flexsearch-td
// or npm install vuepress-plugin-flexsearch-td -D

使用

使用默认方式:

// .vuepress/config.js

module.exports = {
    plugins: [
      ['flexsearch-td'],
      // other plugins
    ]
}

或者自定义搜索参数:

// .vuepress/config.js

module.exports = {
    plugins: [
      ['flexsearch-pro', {
        /*
          自定义搜索参数
        */
        searchHotkeys: ['s'],    // 激活搜索控件的热键, 默认是 "s" ,也可以添加更多热键
        searchResultLength: 60,    // 搜索结果展示的字符长度, 默认是60个字节
      }],
      // other plugins
    ]
}

修改说明

SearchBox.vue

1、适配一个vuepress站点不同路径下中、英、日、文搜索,依据当前路径的url和搜索的关键词(query)判断是中文、英文或者是日文进行匹配FlexSearch实例。

特别感谢

Thanks to nextapps-de/flexsearch and vuepress-plugin-flexsearch and vuepress-plugin-flexsearch-pro