Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: add pathNamespaces option to search plugin #1307

Merged
merged 1 commit into from
Jul 26, 2020

Conversation

palkan
Copy link
Contributor

@palkan palkan commented Jul 24, 2020

Summary

This option allows to dynamically choose the index path depending on the path prefixes in auto mode. Thus, different path namespace could avoid index intersection (e.g., when having multiple locales):

// complete configuration parameters
    search: {
      // ...
      // Use different indexes for path prefixes (namespaces).
      // NOTE: Only works in 'auto' mode.
      //
      // When initialiazing an index, we look for the first path from the sidebar.
      // If it matches the prefix from the list, we switch to the corresponding index.
      pathNamespaces: ['/zh-cn', '/ru-ru', '/ru-ru/v1'],

      // You can provide a regexp to match prefixes. In this case,
      // the matching substring will be used to identify the index
      pathNamespaces: /^(\/(zh-cn|ru-ru))?(\/(v1|v2))?/
    }

Closes #1303.

Array version is used here: docs.anycable.io (LIVE).

RegExp version is used here: test-prof/docs (LIVE).

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Repo settings
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

@vercel
Copy link

vercel bot commented Jul 24, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/3rxipt0zg
✅ Preview: https://docsify-preview-git-fork-palkan-feat-search-path-namespaces.docsify-core.vercel.app

@vercel vercel bot temporarily deployed to Preview July 24, 2020 07:47 Inactive
@palkan palkan force-pushed the feat/search-path-namespaces branch from 5568470 to 6fe2c30 Compare July 24, 2020 07:47
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 24, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d179dde:

Sandbox Source
docsify-template Configuration

This option allows to dynamically choose the index path depending on the path prefixes in auto mode. Thus, different path namespace could avoid index intersection (e.g., when having multiple locales)
Copy link
Member

@sy-records sy-records left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 Looks good.

Copy link
Member

@anikethsaha anikethsaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we dont have test setup for plugins with the core, so I guess its good to go without tests.

LGTM

Copy link
Member

@Koooooo-7 Koooooo-7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COOL ! thx for ur input.

@anikethsaha yup, @sy-records and I checked the simple usage test including the customized storage name, it works fine. we could consider about giving more magic about the isolated namespace in the future

@anikethsaha
Copy link
Member

@anikethsaha yup, @sy-records and I checked the simple usage test including the customized storage name, it works fine. we could consider about giving more magic about the isolated namespace in the future

THats great. Yeah, this looks great

@anikethsaha anikethsaha merged commit aec03d4 into docsifyjs:develop Jul 26, 2020
@palkan palkan deleted the feat/search-path-namespaces branch July 26, 2020 11:45
@sy-records sy-records mentioned this pull request Aug 18, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: dynamic search namespace
4 participants