Skip to content

Weird formatting on documentation of "Summary" button #132564

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
lolbinarycat opened this issue Nov 3, 2024 · 4 comments · Fixed by #132617
Closed

Weird formatting on documentation of "Summary" button #132564

lolbinarycat opened this issue Nov 3, 2024 · 4 comments · Fixed by #132617
Assignees
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Comments

@lolbinarycat
Copy link
Contributor

lolbinarycat commented Nov 3, 2024

location: https://doc.rust-lang.org/nightly/std/#how-to-read-this-documentation

I believe this issue comes from using an svg element inside a code element.

Image

@lolbinarycat lolbinarycat added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Nov 3, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 3, 2024
@jieyouxu jieyouxu added A-rustdoc-ui Area: Rustdoc UI (generated HTML) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 4, 2024
@uellenberg
Copy link
Contributor

This is due to "Summary" having a newline in it. You can see the newline in

//! development you may want to press the <code>
//! <svg style="width:0.75rem;height:0.75rem" viewBox="0 0 12 12"
, where code is on a different line than the SVG.

I'm going to send in a modification, but I'm not sure how to document why that change is being made, so it doesn't happen again. A quick search through the code confirms that this is the only place where we have an inside a in a Rust source file.

@rustbot claim

uellenberg added a commit to uellenberg/rust that referenced this issue Nov 4, 2024
@lolbinarycat
Copy link
Contributor Author

I'm not sure how to document why that change is being made, so it doesn't happen again.

you can put a non-doc comment (//) next to the doc comment.

@uellenberg
Copy link
Contributor

uellenberg commented Nov 4, 2024

I'm not sure how to document why that change is being made, so it doesn't happen again.

you can put a non-doc comment (//) next to the doc comment.

Good idea!

On second thought, I don't love the idea of breaking up documentation with notes on why the documentation is formatted the way it is. I think this isn't so big of an issue that it needs to be commented on.

@lolbinarycat
Copy link
Contributor Author

another option is coding a check into tidy that prevents putting newlines inside inline html elements (as opposed to block html elements, which can have newlines without much issue)

uellenberg added a commit to uellenberg/rust that referenced this issue Nov 5, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Nov 6, 2024
…iper

Fix an extra newline in rendered std doc

Fixes rust-lang#132564

![17308581942254367500907812250579](https://github.com/user-attachments/assets/9e946c49-c0a6-40ba-ab69-b80fe0e085e1)
(taken from the issue above)

The problem with the formatting is due to that newline between `<code>` and `<svg>`. Any newlines outside of the code (i.e., within elements inside of it) are fine.
@bors bors closed this as completed in 934be9b Nov 6, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 6, 2024
Rollup merge of rust-lang#132617 - uellenberg:fix-rendered-doc, r=cuviper

Fix an extra newline in rendered std doc

Fixes rust-lang#132564

![17308581942254367500907812250579](https://github.com/user-attachments/assets/9e946c49-c0a6-40ba-ab69-b80fe0e085e1)
(taken from the issue above)

The problem with the formatting is due to that newline between `<code>` and `<svg>`. Any newlines outside of the code (i.e., within elements inside of it) are fine.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants