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

README example rendering doesn't hide lines #8325

Closed
mpalmer opened this issue Mar 20, 2024 · 5 comments
Closed

README example rendering doesn't hide lines #8325

mpalmer opened this issue Mar 20, 2024 · 5 comments
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works

Comments

@mpalmer
Copy link

mpalmer commented Mar 20, 2024

Current Behavior

I just looked at the crates.io page for my crate, service-skeleton, and noticed that the lines that I thought I'd hidden (using the standard rustdoc mechanism) are showing up in the rendering of the README (such as the line in the first example, under the "Usage" heading, that reads // Yes, this is cheating and the line before/after).

Expected Behavior

The lines that I'm trying to hide wouldn't show up in the README rendering on crates.io.

Steps To Reproduce

  1. Go to https://crates.io/crates/service-skeleton
  2. Scroll down to "Usage"
  3. Look at the first example
  4. Observe that there are lines starting with # visible.

Environment

No response

Anything else?

It's possible I've misunderstood how doctests work, in which case, my apologies, and I'd appreciate a pointer towards what I should be doing instead.

@Turbo87
Copy link
Member

Turbo87 commented Mar 20, 2024

they're also showing up on https://github.com/mpalmer/service-skeleton#usage, which is what we're roughly trying to match. these lines are only hidden on docs output.

@mpalmer
Copy link
Author

mpalmer commented Mar 20, 2024

Yeah, I expect them to show up on GitHub, because it's not likely to understand rustdoc conventions. I figured crates.io, being a Rust-specific site, would be more likely to follow how rustdoc does things, but if not, I guess I'll just have to pull the examples out of the readme, or learn to live with it.

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Mar 24, 2024
@LawnGnome
Copy link
Contributor

I think I missed this issue while travelling in March. (Sorry, @Turbo87!)

I'm kind of -0 on this, honestly.

docs.rs also doesn't treat README files with rustdoc/doctest conventions: note that the # prefixed lines are also visible at https://docs.rs/crate/service-skeleton/0.4.1. I'm also worried that we end up implementing even more of a Markdown dialect that doesn't match anything else: are there other rustdoc features that we'd then need to special case in our Markdown renderer?

Also, unless I'm missing something (probable), rustdoc and cargo test --doc don't generally try to test standalone Markdown files, right? So there's no need for them to be complete, runnable examples for testing purposes — if they are, then I wonder if it makes more sense for them to live in the package-level documentation (ie in src/lib.rs, so in this example at https://docs.rs/service-skeleton/0.4.1/service_skeleton/), instead of being in the README (which might be better served with copy/pastable snippets, regardless of whether they compile as full blown standalone doctests).

But, again, I'm -0, not -1. I guess I think of standalone Markdown files as being a little bit different to inline documentation, but it wouldn't be the first time I have weird ideas about things that most people don't. 😆

@Turbo87
Copy link
Member

Turbo87 commented Jun 26, 2024

@rust-lang/crates-io any other thoughts on this topic?

@Turbo87
Copy link
Member

Turbo87 commented Jul 15, 2024

we discussed this issue in our team meeting last week and concluded that while we don't have a strong opinion we are leaning towards mimicking what GitHub does, instead of Rustdoc.

the best way forward for you would be to find an example snippet for the readme that does not need hidden lines. that will have the added benefit of also rendering the same on GitHub then.

@Turbo87 Turbo87 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants