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

[rustdoc] Respect .editorconfig files for source view #49155

Closed
fbruetting opened this issue Mar 19, 2018 · 8 comments
Closed

[rustdoc] Respect .editorconfig files for source view #49155

fbruetting opened this issue Mar 19, 2018 · 8 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@fbruetting
Copy link

cargo doc files currently show 8-spaces-wide tabs in source view. A general and portable approach for specifying editor settings of whole projects are .editorconfig files. Please respect that, for making sure that alignment doesn’t get destroyed and is the same as in the editor.

@fbruetting fbruetting changed the title cargo doc should respect a .editorconfig file for showing source [cargo doc] Respect .editorconfig files for source view Mar 19, 2018
@fbruetting fbruetting changed the title [cargo doc] Respect .editorconfig files for source view [rustdoc] Respect .editorconfig files for source view Mar 19, 2018
@sapphire-arches sapphire-arches added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Mar 19, 2018
@QuietMisdreavus
Copy link
Member

If rustdoc encounters files with tab characters in them, it should just pass them along to the final source page. It's the web browser which is displaying the tabs with 8-space width. Should rustdoc replace tab characters with a number of spaces based on an .editorconfig file? That seems like quite a bit of overhead.

@fbruetting
Copy link
Author

Replacing tabs with spaces is not a good solution, in my opinion. It would be better to forward the .editorconfig tab setting to the browser. Can this be realized?

@QuietMisdreavus
Copy link
Member

It looks like it's possible to set the tab width in CSS, though it's currently "experimental" and isn't supported in IE/Edge. A small PR to set this to 4 (to match the style guide) could be a quick first step, but i'm less certain on full .editorconfig support. It seems like overkill for a documentation tool to go and look at your text editor's configuration just because it displays source code. I wouldn't reject such a PR outright, but my personal opinion is that i won't prioritize it either.

@rust-lang/rustdoc (and possibly @rust-lang/dev-tools more generally) What do y'all think?

@steveklabnik
Copy link
Member

I personally think this is far too much complexity for too little advantage.

@fbruetting
Copy link
Author

fbruetting commented May 18, 2018

Hardcoding tabwidth = 4 is good enough for me. 😎

With IE/Edge/Microsoft not respecting standards oftentimes, I wouldn’t care about these at all. 😉

@QuietMisdreavus
Copy link
Member

I opened #50947 to hardcode 4 for tab width.

kennytm added a commit to kennytm/rust that referenced this issue May 22, 2018
…umeGomez

rustdoc: set tab width in rust source blocks

cc rust-lang#49155 (fixes it?)

This sets the tab width ([in supported browsers](https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size)) in Rust source blocks to 4 spaces wide (instead of the default 8), to correspond with the style guidelines.
@QuietMisdreavus
Copy link
Member

With #50947 merged, where does that leave this issue? Is .editorconfig support still that pressing for you, or can we go ahead and close this?

@fbruetting
Copy link
Author

Fine, thanks!

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 28, 2020
…Gomez

Fix rustdoc.css CSS tab-size property

This fixes the CSS tab size property names which are called `tab-size` / `-moz-tab-size` and not `tab-width`

Old issue rust-lang#49155 and related PR rust-lang#50947

tab-size: https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants