-
Notifications
You must be signed in to change notification settings - Fork 203
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
Fix crate-level docs not being rendered correctly if there is no readme #2726
Conversation
* Markdown was not rendered * Highlighting wasn't run as expected * Lines start were completely trimmed whereas they shouldn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some questions for my understanding:
We're (kind of) replicating things that rustdoc already did when generating the docs themselves.
Isn't there any way that we could either reuse the machinery? or is rustdoc so near to normal markdown that we're fine here?
Apart from intra-doc links and headings limitations, there is nothing special in rustdoc markdown handling. Also, it's all internal rustdoc code, so unless we write a compiler plugin, we can't access to it. And I don't think it's worth it. |
I made the default syntax configurable and optional. Now, if there is a README, it will have the same behaviour as now. However, if it's coming from the crate-level docs because there is no README, it will apply the same rules as rustdoc: if there is no language specified, then by default it's rust. |
@GuillaumeGomez the test you're probably searching for is this one: docs.rs/src/web/crate_details.rs Lines 2119 to 2188 in d97b27d
You could create a release without readme, but with |
3930e4b
to
004002a
Compare
Added the regression test. :) |
Fixes #2725.
This is an interesting case since there is no README, so instead we tool the crate level docs. But we did a few things wrong:
All fixed in this PR.
@syphar Is there a way to test this except for GUI tests?