Skip to content

Commit 1bedd4d

Browse files
committed
Cut off plain text descriptions after headers
Before: The Rust Standard LibraryThe Rust Standard Library is the foundation of portable Rust software, a set of minimal and battle-tested shared abstractions for the broader Rust ecosystem. It offers core types, like `Vec<T>` and `Option<T>`, library-defined operations on language primitives, standard macros, I/O and multithreading, among many other things. After: The Rust Standard Library
1 parent 5538528 commit 1bedd4d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@ crate fn plain_text_summary(md: &str) -> String {
11241124
Event::HardBreak | Event::SoftBreak => s.push(' '),
11251125
Event::Start(Tag::CodeBlock(..)) => break,
11261126
Event::End(Tag::Paragraph) => break,
1127+
Event::End(Tag::Heading(..)) => break,
11271128
_ => (),
11281129
}
11291130
}

src/librustdoc/html/markdown/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ fn test_plain_text_summary() {
230230
t("code `let x = i32;` ...", "code `let x = i32;` ...");
231231
t("type `Type<'static>` ...", "type `Type<'static>` ...");
232232
t("# top header", "top header");
233+
t("# top header\n\nfollowed by some text", "top header");
233234
t("## header", "header");
234235
t("first paragraph\n\nsecond paragraph", "first paragraph");
235236
t("```\nfn main() {}\n```", "");

0 commit comments

Comments
 (0)