Giter Site home page Giter Site logo

easyops-cn / docusaurus-search-local Goto Github PK

View Code? Open in Web Editor NEW
627.0 627.0 79.0 5.37 MB

Offline/local search for Docusaurus v2/v3

Home Page: https://easyops-cn.github.io/docusaurus-search-local/

License: MIT License

JavaScript 8.55% CSS 4.60% TypeScript 83.70% Shell 0.03% MDX 3.12%
docusaurus docusaurus-v3 docusaurus2 search

docusaurus-search-local's People

Contributors

aericson avatar brianler avatar chernodub avatar csantos1113 avatar cyriuz avatar easyops-eve avatar ezzak avatar f3n67u avatar github-actions[bot] avatar goregius avatar jliermann avatar ksarlou avatar lzhang avatar namnguyenthanhwork avatar release-please[bot] avatar renovate-bot avatar renovate[bot] avatar saosangmo avatar tobiasbueschel avatar utybo avatar weareoutman avatar wfatec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docusaurus-search-local's Issues

Now getting error in build

Please find the error.

Creating an optimized production build...
Error: Cannot find module 'nodejieba'
Require stack:

  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/tokenizer.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/buildIndex.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/postBuildFactory.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/index.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@docusaurus/core/lib/server/plugins/init.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@docusaurus/core/lib/server/plugins/index.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@docusaurus/core/lib/server/index.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@docusaurus/core/lib/commands/build.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@docusaurus/core/lib/index.js
  • /Users/nishit/Documents/GitHub/docusaurus3/node_modules/@docusaurus/core/bin/docusaurus.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object. (/Users/nishit/Documents/GitHub/docusaurus3/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/tokenizer.js:6:45)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object. (/Users/nishit/Documents/GitHub/docusaurus3/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/buildIndex.js:6:21)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1

Multiple instances of docs/blog folders

It would be very nice if the variables:

  • docsRouteBasePath
  • blogRouteBasePath
  • docsDir
  • blogDir

... they were arrays that allow declaring more than one directory when you have multiple instances of "docs" or "blog". Or if it is currently possible to declare more than one "docs/blog", include in the documentation how to do it.

Thank you very much!!

build with error `Command failed with signal "SIGSEGV"`.

When I use docusaurus-search-local to build my document static site, it raise an error without any more information even if I set DEBUG=search-local:*.

Env

  • OS: Linux docker
  • Arch: amd64
  • docusaurus-search-local: 0.14.2
  • nodejieba: 2.5.1
  • node: 4.15.3

Steps

  1. clone my document project https://github.com/hpcde/cluster-docs and checkout to commit "e74db1218a0607a28d07f998b20355f00bc99b79" if possible.
  2. run docker run -it --rm -v ${PWD}:/root/p --entrypoint ash node:14.15.3-alpine3.12
  3. In docker container, run:
cd /root/p
yarn install
USE_LOCAL_SEARCH=ON yarn build

than there is an error like:

✔ Client
  Compiled successfully in 28.20s

✔ Server
  Compiled successfully in 33.53s

error Command failed with signal "SIGSEGV".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

But, if I disable docusaurus-search-local plugin (just run yarn build), everything works fine.

Content under initial # in a docs page is not found

In a markdown page, if I add content directly underneath the top level heading then it does not appear in the search results. For example, if I have a markdown page like:

# My title

Search below title

## Subtitle

Search below subtitle

I then search for the word "search" and it will only show me one result which is the "Search below subtitle" line.

I verified this with a brand new blank Docusaurus install, adding the search plugin and putting some content directly under a title. I can attach the example project if that will be helpful.

Thanks for the great project!

Upgrade autocomplete

Currently this package is referencing an old version of autocomplete, the current algolia version is stable and uses typescript typings which should make the project more type safe. Steps to migrate can be found here.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/react to v18.2.38
  • chore(deps): update dependency typescript to ~5.3.0
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
.github/workflows/gh-pages.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
  • peaceiris/actions-gh-pages v3
.github/workflows/release-please.yml
  • google-github-actions/release-please-action v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/cache v3
npm
.yarn/sdks/eslint/package.json
.yarn/sdks/prettier/package.json
.yarn/sdks/typescript/package.json
docusaurus-search-local/package.json
  • @docusaurus/plugin-content-docs ^2 || ^3
  • @docusaurus/theme-translations ^2 || ^3
  • @docusaurus/utils ^2 || ^3
  • @docusaurus/utils-common ^2 || ^3
  • @docusaurus/utils-validation ^2 || ^3
  • @easyops-cn/autocomplete.js ^0.38.1
  • @node-rs/jieba ^1.6.0
  • cheerio ^1.0.0-rc.3
  • clsx ^1.1.1
  • debug ^4.2.0
  • fs-extra ^10.0.0
  • klaw-sync ^6.0.0
  • lunr ^2.3.9
  • lunr-languages ^1.4.0
  • mark.js ^8.11.1
  • tslib ^2.4.0
  • @docusaurus/module-type-aliases ^3.0.0
  • @docusaurus/theme-common ^3.0.0
  • @docusaurus/tsconfig 3.0.0
  • @docusaurus/types ^3.0.0
  • @types/cheerio ^0.22.31
  • @types/debug ^4.1.5
  • @types/fs-extra ^9.0.2
  • @types/jest ^28.0.0
  • @types/klaw-sync ^6.0.0
  • @types/lunr ^2.3.3
  • @types/node ^18.0.0
  • @types/react ^18.2.37
  • @types/react-helmet ^6.1.0
  • @types/react-router-dom ^5.1.6
  • concurrently ^7.0.0
  • copyfiles ^2.4.0
  • rimraf ^3.0.2
  • typescript ~5.2.2
  • @docusaurus/theme-common ^2 || ^3
  • react ^16.14.0 || ^17 || ^18
  • react-dom ^16.14.0 || 17 || ^18
  • node >=12
package.json
  • @babel/core ^7.17.10
  • @babel/preset-env ^7.17.0
  • @babel/preset-react ^7.16.7
  • @babel/preset-typescript ^7.16.7
  • @typescript-eslint/eslint-plugin ^6.10.0
  • @typescript-eslint/parser ^6.10.0
  • babel-jest ^28.1.0
  • cross-env ^7.0.3
  • eslint ^8.15.0
  • eslint-config-prettier ^8.5.0
  • eslint-plugin-react ^7.29.4
  • eslint-plugin-react-hooks ^4.5.0
  • husky ^8.0.1
  • identity-obj-proxy ^3.0.0
  • jest ^28.1.0
  • jest-environment-jsdom ^28.1.0
  • jest-matcher-utils ^29.6.4
  • lint-staged ^13.0.0
  • prettier ^2.6.2
  • typescript ~5.2.2
  • node >=18
  • @docusaurus/core 3.0.0
  • @docusaurus/module-type-aliases 3.0.0
  • @docusaurus/preset-classic 3.0.0
  • @docusaurus/theme-classic 3.0.0
  • @docusaurus/theme-common 3.0.0
  • @docusaurus/plugin-content-docs 3.0.0
  • @types/react 18.2.37
  • yarn 4.0.1
website-multi-docs/package.json
  • @docusaurus/core ^3.0.0
  • @docusaurus/plugin-content-docs ^3.0.0
  • @docusaurus/preset-classic ^3.0.0
  • @docusaurus/theme-classic ^3.0.0
  • @docusaurus/theme-common ^3.0.0
  • @mdx-js/react ^3.0.0
  • clsx ^1.1.1
  • prism-react-renderer ^2.1.0
  • react ^18.2.0
  • react-dom ^18.2.0
  • @docusaurus/module-type-aliases ^3.0.0
  • node >=16.14
website/package.json
  • @docusaurus/core ^3.0.0
  • @docusaurus/preset-classic ^3.0.0
  • @docusaurus/theme-classic ^3.0.0
  • @docusaurus/theme-common ^3.0.0
  • @mdx-js/react ^3.0.0
  • clsx ^1.1.1
  • react ^18.2.0
  • react-dom ^18.2.0

  • Check this box to trigger a request for Renovate to run again on this repository

Does search requires build?

There are other Docusaurus search plugins that only work when the website is built, does this one also requires that the website is built for it to work?

Specify search results as current version

👋 ,
When I use multiple versions to manage documents, the search results bring up all the version results.
The expectation is to add parameters to Theme Options to specify it as the current version.
For example: currentVersion boolean false to specify search results as the current version.
Many thanks! 🙏

Search text not visible on Search Page in dark mode

Steps to reproduce:

  1. Open the website with the plug-in installed, in dark mode.
  2. Enter a search word into the search field.
  3. Select the See all results option

In the search field at the top of the search page, both the text and the background of the field at white.

Expect: In dark mode, I expect the background of the search field to be dark, similar to the look of the search field in the nav bar.

No indexing when in "docs only mode"

When trying to run a site using the "docs only mode" found here the search indexing doesn't seem to work. I am always shown "no results".

Reproduction Steps

  1. Create a new site: npx create-docusaurus@latest my-website classic --typescript
  2. Delete blog/ folder, all files in docs/, and all files in pages/
  3. Create index.md in docs/ with the content:
---
slug: /
---

# Introduction

Test data
  1. Update docusaurus.config.js
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').Config} */
const config = {
  title: "My Site",
  tagline: "Dinosaurs are cool",
  url: "https://your-docusaurus-test-site.com",
  baseUrl: "/",
  onBrokenLinks: "throw",
  onBrokenMarkdownLinks: "warn",
  favicon: "img/favicon.ico",
  organizationName: "facebook", // Usually your GitHub org/user name.
  projectName: "docusaurus", // Usually your repo name.

  presets: [
    [
      "classic",
      /** @type {import('@docusaurus/preset-classic').Options} */
      ({
        docs: {
          routeBasePath: "/",
          sidebarPath: require.resolve("./sidebars.js"),
        },
        theme: {
          customCss: require.resolve("./src/css/custom.css"),
        },
      }),
    ],
  ],

  themeConfig:
    /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
    ({
      navbar: {
        title: "My Site",
        logo: {
          alt: "My Site Logo",
          src: "img/logo.svg",
        },
        items: [],
      },
      footer: {
        copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
      },
      prism: {
        theme: lightCodeTheme,
        darkTheme: darkCodeTheme,
      },
    }),
  plugins: ["@easyops-cn/docusaurus-search-local"],
};

module.exports = config;
  1. npm run build and npm run serve
  2. Try searching, no results available

I've gotten around this by removing the docs only mode and creating an index.tsx to force a redirect like so:

import React from "react";
import BrowserOnly from "@docusaurus/BrowserOnly";

export default function Home(): JSX.Element {
  return (
    <BrowserOnly>
      {() => {
        window.location.href = `${window.location.origin}/docs`;
        return null;
      }}
    </BrowserOnly>
  );
}

Open search dropdown again after pressing ctrl+k

Currently after searching for something and then pressing ctrl+k or clicking on the search bar, the search menu doesn't show. It would be nice to be able to show in this case. This is useful when trying to search for titles that have duplicated names.

swizzle command

is it possible to run swizzle command on this plugin?
I try this:
npm run swizzle @easyops-cn/docusaurus-search-local SearchBar -- --danger
but it's not working

Suggestions overlay partially outside viewport

The suggestions overlay is partially outside the viewport (on the left) on small screens:
image

I think the overlay's maximum width should be limited to the width of the viewport (minus the horizontal margins). Perhaps using max-width: 100%?

Question: clearing highlights/clearing past searches

I notice that when i'm done with my search there is no way to clear my search highlights. Furthermore I noteicce that if you have multiple searches on the same doc, the prior search's highlights remain.

For instance if I search the phrase "invoke" and choose a hit on the page docs/mydoc and then search "in" and choose the same doc all instances of both "invoke" and "in" will be highlighted.

It'd be helpful to have highlights cleared between searches as well as manually if I want to share a link with my colleague sans highlights.

Is this a feature that exists but is not documented?

Search bar not working for docusaurus version 2.0.0-alpha.75

The following seems to be only an issue on Version 2.0.0-alpha.75. I have tested the search bar for versions v2.0.0-alpha.74 and v2.0.0-alpha.72. They seem to work fine.

I have installed the plugin on a fresh docusaurus (version 2.0.0-alpha.75) installation but am getting the following error a couple of seconds after having started the app.

Uncaught (in promise) TypeError: autoComplete.noConflict is not a function
    at fetchAutoCompleteJS (SearchBar.jsx?6f16:1)
    at async Promise.all (index 1)
    at async eval (SearchBar.jsx?6f16:32)
fetchAutoCompleteJS @ SearchBar.jsx?6f16:1
async function (async)
eval @ SearchBar.jsx?6f16:32
eval @ SearchBar.jsx?6f16:32
callCallback @ react-dom.development.js?61bb:3945
invokeGuardedCallbackDev @ react-dom.development.js?61bb:3994
invokeGuardedCallback @ react-dom.development.js?61bb:4056
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js?61bb:4070
executeDispatch @ react-dom.development.js?61bb:8243
processDispatchQueueItemsInOrder @ react-dom.development.js?61bb:8275
processDispatchQueue @ react-dom.development.js?61bb:8288
dispatchEventsForPlugins @ react-dom.development.js?61bb:8299
eval @ react-dom.development.js?61bb:8508
batchedEventUpdates$1 @ react-dom.development.js?61bb:22396
batchedEventUpdates @ react-dom.development.js?61bb:3745
dispatchEventForPluginEventSystem @ react-dom.development.js?61bb:8507
attemptToDispatchEvent @ react-dom.development.js?61bb:6005
dispatchEvent @ react-dom.development.js?61bb:5924
unstable_runWithPriority @ scheduler.development.js?3069:468
dispatchUserBlockingUpdate @ react-dom.development.js?61bb:5894

Looks like it is originating from here: https://github.com/easyops-cn/docusaurus-search-local/blob/master/src/client/theme/SearchBar/SearchBar.tsx#L29

When I click on the search bar, the load symbol will spin forever without returning results.
Do you need any further information?

add other language

I want to fork this repo and add Persian search to it can you guide me what files should be added and what changes is needed

When Breadcrumbs are enabled the content is not indexed

Since Docusaurus 2.0.0-beta.16 Breadcrumbs are supported (and enabled by default).

When they are enabled, the search only indexes the Headings and not the content of the pages.
Search works again when the breadcrumbs are disabled.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

The search plugins can't search the sub directory when enable docs only mode.

I have documents structure like below:

docs\
    |-subdirectory\
        |-some-document.md
    |-introduction.md

And I enable this setting at docusaurus.config.js:

docs: {
  sidebarPath: require.resolve("./sidebars.js"),
  path: "./docs",
  routeBasePath: "/",
},
blog: false,

The plugin can only search those documents which locate at the root path. The plugin can't search content inside the subdirectory.

I found a solution that set all the subdirectories into the docsRouteBasePath array. The plugin will still work well. But it is hard to maintain when I have plenty of subdirectories. If the plugins can search identifiers recursively into all the subdirectories it will be more convenient.

run in docker image node:14.14.0-buster-slim error

all the package is installed.
command 'npm run build '

Server: Compiled successfully

but log a error:
error building locale=en
Error: /app/node_modules/nodejieba/build/Release/nodejieba.node: invalid ELF header
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (/app/node_modules/nodejieba/index.js:4:17)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (/app/node_modules/@easyops-cn/docusaurus-search-local/dist/server/server/utils/tokenizer.js:6:45)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: docusaurus build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-18T08_00_32_870Z-debug.log

handleSearchBarToggle is not a function

When I click into the searchbar, I get the following error in my console:

Uncaught TypeError: handleSearchBarToggle is not a function
    at eval (SearchBar.jsx?6f16:32)
    at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:188)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:237)
    at invokeGuardedCallback (react-dom.development.js?61bb:292)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js?61bb:306)
    at executeDispatch (react-dom.development.js?61bb:389)
    at executeDispatchesInOrder (react-dom.development.js?61bb:414)
    at executeDispatchesAndRelease (react-dom.development.js?61bb:3278)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js?61bb:3287)
    at forEachAccumulated (react-dom.development.js?61bb:3259)
    at runEventsInBatch (react-dom.development.js?61bb:3304)
    at runExtractedPluginEventsInBatch (react-dom.development.js?61bb:3514)
    at handleTopLevel (react-dom.development.js?61bb:3558)
    at batchedEventUpdates$1 (react-dom.development.js?61bb:21871)
    at batchedEventUpdates (react-dom.development.js?61bb:795)
    at dispatchEventForLegacyPluginEventSystem (react-dom.development.js?61bb:3568)
    at attemptToDispatchEvent (react-dom.development.js?61bb:4267)
    at dispatchEvent (react-dom.development.js?61bb:4189)
    at unstable_runWithPriority (scheduler.development.js?3069:653)
    at runWithPriority$1 (react-dom.development.js?61bb:11039)
    at discreteUpdates$1 (react-dom.development.js?61bb:21887)
    at discreteUpdates (react-dom.development.js?61bb:806)
    at dispatchDiscreteEvent (react-dom.development.js?61bb:4168)

Let me know, if you need any more information! Thanks

Docs not indexed if `docsRouteBasePath` is set to "/"

I suppose this is half issue and half feature request.

I prefer to use Docusaurus on a subdomain (docs.example.com) instead of a subdirectory (example.com/docs/). This is possible by setting docs: { routeBasePath: "/" } in docusaurus.config.js, but it would appear that docusaurus-search-local doesn't support the same routing.

A workaround I've discovered is to modify line 49 of processDocInfos.ts from:

docsRouteBasePath.some((basePath) => urlMatchesPrefix(route, basePath))

to:

(docsRouteBasePath == "" || docsRouteBasePath.some((basePath) => urlMatchesPrefix(route, basePath)))

This works for me since I don't need to index pages. However, this approach will break page indexing if docsRouteBasePath is set to root, since this condition will always return true. Perhaps a better solution would be to add a condition to processPluginOptions.ts to enable processing root paths properly instead of simply regex replacing them to empty strings.

Search bar doesn't appear

Hello
I've followed through the installation guide but, the search bar does not appear after the build as if the plugin's not working, I'm sure there's some misconfiguration on my part but, troubleshooting has been proving fruitless so far.
I'd be delighted if I'd get any help figuring this out.

Report: I entered the npm install --save @easyops-cn/docusaurus-search-local in my project directory and then added the plugin in the docusaurus.config.js as below:

There are no errors, everything seems fine but the search bar doesn't appear

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
  plugins: [
     [require.resolve("@easyops-cn/docusaurus-search-local"),
             {hashed: true}
     ],
  ],

  title: "TITLE",
  tagline: "TAGLINE",
  url: "https://your-docusaurus-test-site.com",
  baseUrl: "/",
  onBrokenLinks: "warn",
  onBrokenMarkdownLinks: "warn",
  favicon: "IMG",
  organizationName: "facebook", // Usually your GitHub org/user name.
  projectName: "docusaurus", // Usually your repo name.
  themeConfig: {
    navbar: {
      title: "TITLE",
      logo: {
        alt: "TITLE",
        src: "IMG"
      },
      items: [
        {
          type: "doc",
          docId: "Home",
          position: "left",
          label: "Documents"
        },
      ]
    },
    footer: {
      style: "dark",
      links: [
        {
          title: "Docs",
          items: [
            {
              label: "Home",
              to: "/docs/Home"
            },

          ]
        },
        ],
       },
    prism: {
      theme: lightCodeTheme,
      darkTheme: darkCodeTheme
    }
  },
  presets: [
    [
      "@docusaurus/preset-classic",
      {
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          // Please change this to your repo.
          editUrl: "https://github.com/facebook/docusaurus/edit/master/website/"
        },
        blog: {
          showReadingTime: true,
          // Please change this to your repo.
          editUrl:
            "https://github.com/facebook/docusaurus/edit/master/website/blog/"
        },
        theme: {
          customCss: require.resolve("./src/css/custom.css")
        }
      }
    ]
  ]
};

I copied the whole config file in case it'd help figure this out.

Many thanks in advance.

Add shortcut support

I would like to ask if there is support for the focusShortcuts property or the algolia/autocomplete library that you use doesn't support it?

Thanks in advance!

root index.html is not indexed in docs only mode

In a docs-only site (routeBasePath: "/"), I have a page with slug /, which produces an index.html in the root build directory. Looks like this root index.html in not indexed, every other page is working as intended. I have following option for @easyops-cn/docusaurus-search-local:

themes: [
      [
        require.resolve("@easyops-cn/docusaurus-search-local"),
        {
          hashed: true,
          docsRouteBasePath: "/",
          indexBlog: false,
          indexPages:true,
          highlightSearchTermsOnTargetPage: true,
        },
      ],
    ],

Thank you.

index language pt fail

Hello congratulations for the work!

I'm having trouble indexing words in Portuguese(pt). For example, words like "introdução", "documentação" are not found. I believe the problem is in recognizing characters such as ç ã

docusaurus.config.js

Captura de tela de 2020-10-28 16-29-37

DEBUG=search-local:* yarn build

Captura de tela de 2020-10-28 16-28-45

[feature] fetch multiple search-index.json files

Summary

We are using this in multiple docs sites internally and were wondering if you would be interested in being able to support a option where we can define multiple search-index.json sources so we can have multi-tenant search?

We would be willing to add this!

Search page not working

I'm testing out this plugin. It works really well except on the search modal, when you click "see all results," you are taken to a page that appears to not work. If you type anything on this page in the search box, nothing is returned whereas the nav bar version works.

  1. Is this a known issue?
  2. In the meantime, would it be possible to hide this option?

Here is my draft site: https://psdocs.netlify.app

yarn list:

yarn list v1.22.17
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @docusaurus/[email protected]
├─ @easyops-cn/[email protected]
└─ @easyops-cn/[email protected]

node version: v16.13.2

Thanks!

Docusaurus build fails when "trailingSlash: false"

Hi! Recently the Docusaurus team introduced a new configuration option trailingSlash: boolean | undefined, see here.

When specifying trailingSlash: false and using "@easyops-cn/docusaurus-search-local": "^0.16.3" the Docusaurus build breaks. You can reproduce the issue on this branch.

Unable to build website for locale "en".
Error: ENOENT: no such file or directory, open 'path/build/docs/index.html'

override some css of search bar

I'm putting the search bar right on the sidebar of my docs page, so I need to change some css properties.
For example: left: auto !important, I can't override it because my custom css has lower priority.
Is there a way to swizzle the entire search bar? I tried the docusaurus default command, but since the code uses quite a lot of relative paths it doesn't work.

Version support

It would be good if we could have version support, or at least a way of not indexing all versions. Currently results are shown for all versions resulting in duplicate search results for each version in the docs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.