Skip to content

Code blocks wrap #17017

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

Closed
steveklabnik opened this issue Sep 5, 2014 · 8 comments
Closed

Code blocks wrap #17017

steveklabnik opened this issue Sep 5, 2014 · 8 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@steveklabnik
Copy link
Member

The guide currently has code sections that wrap: http://i.gyazo.com/8c2ac3f95775dd4847b3f0aae204eaa4.png

These sections are the regular, 100 col length. Rustdoc should make the code blocks wide enough to not let this happen.

@robertg
Copy link

robertg commented Sep 5, 2014

I agree, it certainly looks ugly, we should make it scrollable. (Since they violate the rust formatting rules, but they should still be readable).

@MatejLach
Copy link
Contributor

@rgawdzik I think making them scrollable will look kind of ugly, especially considering that this is the official documentation.
A better approach would be to try to fix the formatting to satisfy rustdoc (or adjust rustdoc itself accordingly).
BTW what is the reasoning behind the 100 column limit? I would expect something closer to 160 these days.

@robertg
Copy link

robertg commented Sep 6, 2014

Actually scratch that, those code blocks being cut off are well below the 100 column limit. We should make the styling force the codeblocks to always have 100 columns.

@bluss
Copy link
Member

bluss commented Sep 7, 2014

I don't see why you need 100 or 160(!) columns for code written explicitly for documentation, inline in the document. The text is already intentionally flowed in a narrower column than window width to be more readable.

@steveklabnik
Copy link
Member Author

Because Rust style is 100 character lines.

@steveklabnik steveklabnik added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Sep 2, 2015
@steveklabnik
Copy link
Member Author

Triage: no change. Tagging E-easy because this should just be a CSS change.

@steveklabnik
Copy link
Member Author

http://doc.rust-lang.org/nightly/book/lifetimes.html#examples now contains an example of this, I think the original screenshot is gone now. the line

fn frob<'a, 'b>(s: &'a str, t: &'b str) -> &str; // Expanded: Output lifetime is ambiguous

is 91 characters long, but wraps.

@marti1125
Copy link
Contributor

thanks for the example @steveklabnik I am cheking that

@bors bors closed this as completed in 7f9c4aa Sep 29, 2015
lnicola pushed a commit to lnicola/rust that referenced this issue May 19, 2024
Implement creating generics for impl traits in associated types

Hopefully fix rust-lang#17017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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

5 participants