-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
rustdoc: item summaries that are headers are not printed in module pages, under hoedown #46377
Copy link
Copy link
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
This will show up differently in docs depending on whether Hoedown or Pulldown is being used. It's not a rendering difference for the markdown, per se, it's how the summary line is generated:
That function is used to truncate markdown renderings from Hoedown for summary lines on module pages. Hoedown (presumably) emits an extra blank line before the
<h1>in this sample, so thisshorterfunction immediately sees a blank line and emits an empty string.A fix for this could just add a
skip_while(|s| s.chars().all(|c| c.is_whitespace()))before thetake_whilethere, which would skip all empty/blank lines before the first block of text, and thus properly grab the first item from the block.(Note: the reason this actually emits the header in Pulldown is that under Pulldown,
shorteris not actually called! It goes through a separate adapter that wraps the event emitter from Pulldown and stops once the first block is complete. This way it skips the leading-whitespace problem entirely.)