-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Direct link when searching for a short code #13684
Comments
Hmm, that's unfortunate. We would have to look into our Algolia search configuration to see how it index pages and either change the Algolia configuration or the structure of the rule's page. I don't think I've access to Algolia (@charliermarsh ) |
I think we'd need some sort of support in material-for-mkdocs, e.g., via https://squidfunk.github.io/mkdocs-material/plugins/search/. |
Author of Material for MkDocs here – results should drastically improve once we release the new search, which is currently blocked by a bigger refactor we're working on in the background (@charliermarsh we talked about this recently), as mentioned in our latest blog post. Once we got a first version of that ready, we'll reach out to you for giving it a try In the meantime, as a bandaid, you should be able to improve discovery by using tags, and tagging each rule with its modifier. Tags currently take precedence over everything else in search: ---
tags:
- ruf005
---
# Tag name |
Wow thanks @squidfunk for the details! Adding the tags should be a very straightforward change and looking forward to the new search engine |
I've pushed a PR that adds these tags to the function used to generate the page metadata - I think this should be all that's required but absolutely open to input & feedback on how to do it. |
## Summary <!-- What's the purpose of the change? What does it do, and why? --> This PR updates the metadata in the YAML frontmatter of the mkdocs documentation to include the rule short code as a tag, so it can be easily searched. Ref: #13684 ## Test Plan <!-- How was it tested? --> This has been tested locally using the documentation provided [here](https://docs.astral.sh/ruff/contributing/#mkdocs) for generating docs. This generates docs that now have the tags section: ```markdown --- description: Checks for abstract classes without abstract methods. tags: - B024 --- # abstract-base-class-without-abstract-method (B024) ... trimmed ``` I've also verified that this gives the ability to get straight to the page via search when serving mkdocs locally. --------- Co-authored-by: Charlie Marsh <[email protected]>
## Summary <!-- What's the purpose of the change? What does it do, and why? --> This PR updates the metadata in the YAML frontmatter of the mkdocs documentation to include the rule short code as a tag, so it can be easily searched. Ref: astral-sh#13684 ## Test Plan <!-- How was it tested? --> This has been tested locally using the documentation provided [here](https://docs.astral.sh/ruff/contributing/#mkdocs) for generating docs. This generates docs that now have the tags section: ```markdown --- description: Checks for abstract classes without abstract methods. tags: - B024 --- # abstract-base-class-without-abstract-method (B024) ... trimmed ``` I've also verified that this gives the ability to get straight to the page via search when serving mkdocs locally. --------- Co-authored-by: Charlie Marsh <[email protected]>
The PR implementing this (#14040) has been merged and has been deployed with the release of |
When I type a short code in the search bar on the website (https://docs.astral.sh/ruff), for example
ruf005
, the search suggestion is a link to the list of warnings. When I type a long code, for examplecollection-literal-concatenation
, the search suggestion is a direct link to the warning's article. Could the short code case be changed?The text was updated successfully, but these errors were encountered: