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

Add format indent for generated code link with rust-playground #120998

Closed
chenyukang opened this issue Feb 13, 2024 · 0 comments · Fixed by #121095
Closed

Add format indent for generated code link with rust-playground #120998

chenyukang opened this issue Feb 13, 2024 · 0 comments · Fixed by #121095
Assignees
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) 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

@chenyukang
Copy link
Member

This idea is from #119161

When clicking the Run button, will jump to the rust-playground, the code is not indent well:

image

the link is generated from code:

doctest::make_test(&test, krate, false, &Default::default(), edition, None);

I would be nice if we add extra indent space for the code block after inserting fn main { for the code in document.

I checked rust-playgrund, seems there is no a URL argument like format=true for the code link.

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 13, 2024
@chenyukang chenyukang added the A-rustdoc-ui Area: Rustdoc UI (generated HTML) label Feb 13, 2024
@fmease fmease 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. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 13, 2024
@chenyukang chenyukang self-assigned this Feb 14, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Feb 15, 2024
…playground-link, r=GuillaumeGomez

Add extra indent spaces for rust-playground link

Fixes rust-lang#120998

Seems add `rustfmt` for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.
oli-obk added a commit to oli-obk/rust that referenced this issue Feb 15, 2024
…playground-link, r=GuillaumeGomez

Add extra indent spaces for rust-playground link

Fixes rust-lang#120998

Seems add `rustfmt` for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.
@bors bors closed this as completed in a7e486a Feb 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 16, 2024
Rollup merge of rust-lang#121095 - chenyukang:yukang-fix-120998-rust-playground-link, r=GuillaumeGomez

Add extra indent spaces for rust-playground link

Fixes rust-lang#120998

Seems add `rustfmt` for this is somehow too heavy,
only adding indent spaces at the starting of each line of code seems good enough.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) 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

Successfully merging a pull request may close this issue.

3 participants