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

Add ignoreCssSelectors option #348

Merged
merged 3 commits into from Sep 9, 2023

Conversation

Cyriuz
Copy link
Contributor

@Cyriuz Cyriuz commented Sep 4, 2023

I found myself in need of ignoring more custom elements from the search indexing so I thought this would be a good additional option to make the plugin even more flexible.

I also took the time to fix so that the tests complete fine on Windows with the differing path separators.

@netlify
Copy link

netlify bot commented Sep 4, 2023

Deploy Preview for easyops-cn-docusaurus-search-local ready!

Name Link
🔨 Latest commit 4e2bc60
🔍 Latest deploy log https://app.netlify.com/sites/easyops-cn-docusaurus-search-local/deploys/64fb4055767951000748baa2
😎 Deploy Preview https://deploy-preview-348--easyops-cn-docusaurus-search-local.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Cyriuz Cyriuz changed the title Add ignore classes option Add ignoreClasses option Sep 4, 2023
@Cyriuz
Copy link
Contributor Author

Cyriuz commented Sep 8, 2023

@weareoutman do you think you'll have time to look at this? I'm just thinking if I should look into deploying it as a fork.

README.md Outdated
@@ -87,6 +87,7 @@ module.exports = {
| searchResultContextMaxLength | number | `50` | Set the max length of characters of each search result to show. |
| explicitSearchResultPath | boolean | `false` | Whether an explicit path to a heading should be presented on a suggestion template. |
| ignoreFiles | string \| RegExp \| (string \| RegExp)[] | `[]` | Set the match rules to ignore some routes. Put a string if you want an exact match, or put a regex if you want a partial match. Note: without the website base url. |
| ignoreClasses | string \| string[] | `[]` | A list of html classes to ignore when indexing each page. |
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for your contributions! How about change this option to ignoreCssSelectors? So that users can ignore not only by classes, but also by other css selectors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, not sure why I didn't do that from the start :) Fixed it!

@Cyriuz Cyriuz changed the title Add ignoreClasses option Add ignoreSelectors option Sep 8, 2023
@Cyriuz Cyriuz changed the title Add ignoreSelectors option Add ignoreCssSelectors option Sep 8, 2023
@weareoutman weareoutman merged commit 211a817 into easyops-cn:master Sep 9, 2023
7 checks passed
@weareoutman
Copy link
Member

Thanks, released v0.36.0

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.

None yet

2 participants