-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Highlight the word result that searched #2450
Comments
Hi @LIGMATV , TBH, it is not that feasible to docsify since the search function (plugin) and the main contents are isolated. |
I can think of a few different ways to handle this fairly easily. Option 1: The search plugin can add a separate plugin to the plugins array that determines if a search is currently active and, if so, parses and marks content before it is rendered. Option 2: When navigation occurs, the The most challenging part will likely be determining which matches to mark and which ones to ignore. For example, we don't want mark matches within a |
Hi @jhildenbiddle, I think It is not a normal behavior for search engines or for a documentation site. The 'highlight' feature is used to display the matched contents in the search result list, not in the main content. This holds true even when using And back to the docs site functions itself:
Additionally, the browser search function for the search matched target page is more convenient if really needs. |
@Koooooo-7 -- I don't think there's a right or wrong answer on this one. It's a preference that can change based on the user, the type of search being performed, or where a matching search term is located in the content area. My comment above was focused more on how we could implement highlighting matching search terms in the content area in response to the "it is not that feasible" statement in the comment prior to mine. Regarding if we should offer this feature, here are a few things to consider...
Not sure what you mean by "incomplete" search results. The behavior I am referring to is highlighting matching search results on pages loaded by clicking on a search result in a sidebar. When an active search term is modified, the previous search results are cleared as well as any highlighted content in the content area. We would not do "live" highlighting of the content area based on what a user types in our search field. If users find content highlighting distracting, users can disable the feature (assuming a user-facing toggle is provided) or clear the search results via ESC or the clear button. The content and page position will remain unchanged when this occurs.
We cannot assume a heading is the only context needed/wanted for all matching search terms on every site. It is equally likely that the text surrounding a matching search term provides more useful context than the heading the search term resides under, in which case allowing users acquire this context as quickly as possible should be the goal. This is often true for matching search terms found in a large blocks of content, callouts/admonishments, list items, code blocks, etc.
See above. My preference regarding this feature in order of preference:
Personally, I like option 1 with the toggle set to "off" by default. |
@jhildenbiddle If the user requirements is not a common use case nor the common functions cross the competitors or other apps, and it is not a brand new things only we can do, I don't think we need bring it in with high priority.
I'm not a follower that we only do others do, but again, I consider about the product itself. I participated design and know few (3? IIUC) of sites do have the
Yes, but it brings the thing what we normally need:
Yes, I agree, and this is what makes this requirement reasonable.
For a short page/section, the highlight or not doesn't matter. For a long content, such as highlight a function name
Personally, normally, I don't think user will scroll down to find the highlight part in the 5000 lines code block.
highlighting incomplete search means I input the I believe that we can make it. Option1 is great to me.
I only consider should we brings it to our side as a common feature very quick. BTW: the search plugin's priority higher things in my mind:
|
Agreed on the priority. This doesn't need to be part of v5 release, but it could be handled in a v5.x point release in the future. I'm fine leaving I tagged as "Future" for now. Regarding search plugin priorities, I would add #1369 to the list of items we should get to sooner than later. |
Feature request
Problem or desire
I searching for the "Beginilah" result
When i click the result, it just go to the Heading of text, not highlight the word.
Proposal
Highlight the word that searched, so we know where it is
Implementation
Add new element for the highlited searched words like
<mark class="searched"
...The text was updated successfully, but these errors were encountered: