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

Support direct links to options on Configuration documentation site #4261

Closed
calebcartwright opened this issue Jun 19, 2020 · 9 comments · Fixed by #4272
Closed

Support direct links to options on Configuration documentation site #4261

calebcartwright opened this issue Jun 19, 2020 · 9 comments · Fixed by #4272
Labels
documentation good first issue Issues up for grabs, also good candidates for new rustfmt contributors help wanted

Comments

@calebcartwright
Copy link
Member

AFAIK our Configuration documentation site doesn't support direct links to configuration options. It'd be great to be able to do so like we can with the in-repo markdown file.

Works 👉 https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#reorder_modules
Doesn't work 👉 https://rust-lang.github.io/rustfmt/#reorder_modules

I suspect the solution for this will end up being closely related to #4260, though opening as a separate issue in case it can be solved more quickly/independently.

Also refs #4178 and #4221

@aszenz
Copy link
Contributor

aszenz commented Jun 20, 2020

@calebcartwright

After reading about this issue and wanting to work on it I find that by clicking on the link https://rust-lang.github.io/rustfmt/#reorder_modules the configuration options are being filtered by the hash text.

So the link essentially fills in the search bar with reorder_modules and then the options are filtered by this text, thereby showing just the reorder_modules option.

So in a way this is already supported but instead of a direct link the hash term is used for search.

@hbina
Copy link

hbina commented Jun 20, 2020

@aszenz Was looking into this as well. That is really wonky, it does not even filter out the first 2 sections...

@aszenz
Copy link
Contributor

aszenz commented Jun 20, 2020

@hbina That seems deliberate the first two sections are headers and the search only applies to the configuration options, the searchTerm is filled in from the url hash as well

@calebcartwright
Copy link
Member Author

Yup, the current search is more of a filter/show all options that include the needle text within their section. This is particularly noticeable for common items (try using max_width for example)

@aszenz
Copy link
Contributor

aszenz commented Jun 20, 2020

Yes and is it something that should be changed, I do see it as being less useful than direct linking.

@calebcartwright
Copy link
Member Author

I do see it as being less useful than direct linking.

I see these as orthogonal, and don't want to minimize either. It's entirely valid that a user may want to narrow down the page content to a specific area they are interested in at that moment (for example "show me all the options that impact match formatting)

@aszenz
Copy link
Contributor

aszenz commented Jun 21, 2020

I see these as orthogonal, and don't want to minimize either. It's entirely valid that a user may want to narrow down the page content to a specific area they are interested in at that moment (for example "show me all the options that impact match formatting)

Yes that's what search is for, but using the url hash for search is a bit unorthodox, usually its done using a query parameter like ?search=term. The hash is usually reserved for directly linking to specific parts of the page.

@calebcartwright
Copy link
Member Author

@aszenz - My point is that both search/filter and direct linking/navigation are equally useful and that we need to support both.

I'm entirely open to any solution that delivers both, including any that changes the current uri search behavior. We just can't go with an approach that provides direct linking/navigation but removes search/filter entirely.

@ayazhafiz
Copy link
Contributor

I agree with @calebcartwright, both should be supported. The search term is better as a query param, and linking to the header of an option with a url hash is easy, the markdown renderer just needs to be given a function to render the header with an id equal to the option name. Adding a link icon like github does can be done the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation good first issue Issues up for grabs, also good candidates for new rustfmt contributors help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants