question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: dynamic search namespace

See original GitHub issue

Feature request

What problem does this feature solve?

Make it possible to dynamically change search namespace to isolate different parts of the documentation. For example, we can isolate different locales from each other while using aliases. Right now, search index is built for all pages, and hence some queries return results for multiple locales at once (try searching for index.html at https://docsify.js.org/).

What does the proposed API look like?

I’m currently using a patched version of the search plugin which updates CONFIG.namespace in afterEach callback by using the value from vm.config.search.namespace: https://github.com/test-prof/docs/blob/cb7826d37b37a338df64830fa85f6132f82992a6/docs/assets/docsify-search.js#L325

Thus, in order to change the namespace you need to update vm.config.search.namespace in your plugin.

That works fine for me but it’s not an ideal solution.

Probably, exposing an API to switch the namespace would be better, e.g.: vm.config.search.switchNamespace(...) or even vm.plugins.search.switchNamespace(...).

How should this be implemented in your opinion?

Long term: provide and API to access plugin instances, and thus making it possible to communicate with plugins from other plugins.

Short term: update namespace from the current vm.config settings in the init function: https://github.com/docsifyjs/docsify/blob/b8690199006366e86084e9e018def7b9b8f46512/src/plugins/search/search.js#L196

Are you willing to work on this yourself?

Sure.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Koooooo-7commented, Jul 23, 2020

Cool. @sy-records and I discussed about the namespace for solving #1300 issue , but we hvnt find an ideal way yet. Glad to see the draft and wait for the PR. 👍

0reactions
palkancommented, Jul 23, 2020

It looks like nonbreaking. (correct me if I am wrong)

Yep, it is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic namespace module pattern - javascript
Dynamic mechanism for setting a javascript namespace. * * This works by adding the namespaceName as an attribute to the script * element...
Read more >
Add Dynamic Search Ads | Google Ads API | Google Developers
Adds a new dynamic search ad (DSA) and webpage targeting criteria for the DSA. */ public class AddDynamicSearchAds {
Read more >
Proposal: PHP 5.3 Namespaces for module-provided ... - Drupal
After tons of other namespace discussions, here is a workable proposal for namespaces in module-provided procedural code and hook ...
Read more >
Using dynamically loaded namespaces like plug-ins
I wanted to use dynamic loading of namespaces to achieve sort of a plugin structure but got kind of struck. I have a...
Read more >
Sample: Search for openings to schedule a resource
This sample code is for Dynamics 365 for Customer Engagement. ... Xrm.Sdk.Messages; // This namespace is found in Microsoft.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found