-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: fix summary lines #31902
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
rustdoc: fix summary lines #31902
Conversation
cc @bluss |
Response time is A+++ 😄 |
I just remembered that this function is also used for the search-index descriptions, which are not markdown rendered. So that still needs the old behaviour. I'm going to push an update as soon as I have time. |
The idea here was to render headers like: /// really long intro
/// comment
///
/// more explanation
as "really long intro comment", but doesn't this break that as only the first line is taken? |
dfaeaf8
to
5d33b35
Compare
You're right, I guess I got a bit confused by looking at the HTML source through inspector, which doesn't show the newlines in the /// A tuple or fixed size array that can be used to index an array.
/// Make this line a bit longer.
///
/// ```
/// use ndarray::arr2;
/// ```
pub fn bar() {} actually is
Because of this I'm now extracting the first occuring html element in the string which seems to me the correct way to go. |
Er hang on, can we drill into what the bug is in the first place? I'd really like to avoid having any sort of HTML parser in rustdoc just to extract the first It looks like the bug may be that we're extracting text after rendering, when we should be extracting before rendering? |
The problem doesnt appear with two paragraps, but with one paragraph and a codeblock. Specifically hoedown doesnt leave a blank line in this case. ..perhaps we could insert a dummy item between the first and second block, which we know leaves a blank line, before we markdown render it? (and then shorten it after rendering)
|
Can we perhaps alter the hoedown rendering of code blocks to insert the blank line for us? That may be a good fix in the case that code blocks are the only cause of this. |
Oh right, we can do that 😄 (updated) |
For summary descriptions we need the first paragraph (adjacent lines until a blank line) - but the rendered markdown of a code block did not leave a blank line in the html and was thus included in the summary line.
For plaintext we don't actually need to render the Markdown before shortening the string. (and this may have led to wrong output)
Thank you @mitaa ! |
fixes #31899
r? @alexcrichton