Skip to content

rustdoc: Only hide lines starting with # in rust code blocks #105539

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

Merged

Conversation

GuillaumeGomez
Copy link
Member

Fixes #105527.

So before approving, this is a big question: in rust code blocks, in a line starts with a #, we hide it in the output. However, should we do the same for non-rust code blocks too? I think it's a bit problematic to do it because # can be used for many things but I prefer to check first with everyone (might also be worth updating documentation too).

cc @rust-lang/rustdoc
r? @notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 10, 2022
@jsha
Copy link
Contributor

jsha commented Dec 10, 2022

I agree we should not hide # lines for non rust blocks.

@camelid
Copy link
Member

camelid commented Dec 11, 2022

I agree that we should only hide # lines for Rust code blocks. For example, the following code

/// ```markdown
/// # Header
/// ```

should render as

# Header

whereas currently I think it would render as nothing?

EDIT: Yep, I just checked, and it renders as an empty code block. That seems like definitely unintended behavior.

@notriddle
Copy link
Contributor

That’s four of us.

@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 11, 2022

📌 Commit bc63c0e has been approved by notriddle

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 11, 2022
@camelid
Copy link
Member

camelid commented Dec 11, 2022

UPDATE: This is actually a stable-to-stable regression: #105527 (comment)

@GuillaumeGomez GuillaumeGomez added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 11, 2022
@GuillaumeGomez
Copy link
Member Author

Well, better late than never for an old fix. I added a "beta nominated" label so we can at least have this fix available one version sooner.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Dec 11, 2022
…ines-non-rust, r=notriddle

rustdoc: Only hide lines starting with `#` in rust code blocks

Fixes rust-lang#105527.

So before approving, this is a big question: in rust code blocks, in a line starts with a `#`, we hide it in the output. However, should we do the same for non-rust code blocks too? I think it's a bit problematic to do it because `#` can be used for many things but I prefer to check first with everyone (might also be worth updating documentation too).

cc `@rust-lang/rustdoc`
r? `@notriddle`
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 11, 2022
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#105411 (Introduce `with_forced_trimmed_paths`)
 - rust-lang#105532 (Document behaviour of `--remap-path-prefix` with several matches)
 - rust-lang#105537 (compiler: remove unnecessary imports and qualified paths)
 - rust-lang#105539 (rustdoc: Only hide lines starting with `#` in rust code blocks )
 - rust-lang#105546 (Add some regression tests for rust-lang#44454)
 - rust-lang#105547 (Add regression test for rust-lang#104582)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dd00582 into rust-lang:master Dec 11, 2022
@rustbot rustbot added this to the 1.68.0 milestone Dec 11, 2022
@GuillaumeGomez GuillaumeGomez deleted the hashtag-prepended-lines-non-rust branch December 11, 2022 12:46
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 11, 2022
…tag-prep-line, r=notriddle

Extend rustdoc hashtag prepended line test

Follow-up of rust-lang#105539. This case wasn't checked so better add it.

r? `@notriddle`
@pietroalbini pietroalbini added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Dec 12, 2022
@pietroalbini
Copy link
Member

Approved for backport in https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/1.2E66.2E0/near/315377940.

Note: the beta-nominated label needs to be kept when backporting to 1.66, as a backport to 1.67 is also needed.

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 12, 2022
…troalbini

[stable] Prepare 1.66.0 release

This PR prepares the artifacts for the 1.66.0 release. The following PRs have been backported:

* rust-lang#104782
* rust-lang#105023
* rust-lang#104558
* rust-lang#104610
* rust-lang#103989
* rust-lang#104650
* rust-lang#105539
* rust-lang#105477

r? `@ghost`
@Mark-Simulacrum Mark-Simulacrum modified the milestones: 1.68.0, 1.67.0 Dec 26, 2022
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 26, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 27, 2022
…mulacrum

[beta] backport rollup

* Revert "Replace usage of ResumeTy in async lowering with Context" rust-lang#105915
*  Don't copy symbols from dylibs with -Zdylib-lto rust-lang#105800
*  rustdoc: Only hide lines starting with # in rust code blocks rust-lang#105539
*  Mangle "main" as "__main_void" on wasm32-wasi rust-lang#105468

r? `@ghost`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rustdoc does not format ASCII art containing ### at the start of a line correctly
8 participants