- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Custom search.seperator with lookbehind, in combination with highlighter, produces highlighting all over the place #5655
Comments
Thanks for reporting and the possible fix. We're currently reworking the search and everything that is related, so we currently don't consider adding a new separator configuration setting, because highlighting will be solved differently with the new plugin. However, we can definitely merge the fix for the lookbehind. |
Keeping open until released. |
Released as part of 9.1.18. Thanks for your help on this issue! |
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [mkdocs-material](https://togithub.com/squidfunk/mkdocs-material) | patch | `==9.1.17` -> `==9.1.18` | --- ### ⚠ Dependency Lookup Warnings ⚠ Warnings were logged while processing this repo. Please check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>squidfunk/mkdocs-material (mkdocs-material)</summary> ### [`v9.1.18`](https://togithub.com/squidfunk/mkdocs-material/releases/tag/9.1.18): mkdocs-material-9.1.18 [Compare Source](https://togithub.com/squidfunk/mkdocs-material/compare/9.1.17...9.1.18) - Updated Danish translations - Added support for installing user requirements in Docker image - Fixed #​[https://github.com/squidfunk/mkdocs-material/issues/5655](https://togithub.com/squidfunk/mkdocs-material/issues/5655)s/5655): Search separator with lookbehind breaks highlighting </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4xNTkuNCIsInVwZGF0ZWRJblZlciI6IjM1LjE1OS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->
Context
A custom search.seperator with lookbehind, in combination with highlighter, produces highlighting all over the place on the page.
This occured when adjusting the camelCasing/PascalCasing seperator to not seperate words if the words get too small e.g.
AStar
should not be seperated to highlightA
+Star
. In such cases the relevance of pages containingAStar
compared to chapters containing justStar
gets left behind and not found by users.Description
There is in the sourcecode a hack in place
src\assets\javascripts\integrations\search\highlighter\index.ts
which reuses the search.seperator for the highlighting by removing lookaheads, it does however not yet remove lookbehinds. Thus when using lookbehinds the highlighting goes bonkers.There would be two ways to solve this:
So its kind of a bug, but also a change request.
To solve the bug adjust in
src\assets\javascripts\integrations\search\highlighter\index.ts
:Related links
Use Cases
In general seperating things like
IsFloat
etc also is not useful as when searching code Is+Float will result in many results but not in the function to find.So the idea was to start the seperation of camelCasing/PascalCasing only with
3>=
characters. Which would start with the classicGet / Set / Can
but not with Is, or Single char prefixes.The separator casing fragment was modified in such way:
(?!\b)(?=[A-Z][a-z]{2,})(?<!\b\w{0,2})
Sample:
Visuals
No response
Before submitting
The text was updated successfully, but these errors were encountered: