mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 09:53:04 +03:00
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
This commit is contained in:
@@ -1124,6 +1124,7 @@ fn push(s: &mut String, text_length: &mut usize, text: &str) {
|
||||
Event::HardBreak | Event::SoftBreak => s.push(' '),
|
||||
Event::Start(Tag::CodeBlock(..)) => break,
|
||||
Event::End(Tag::Paragraph) => break,
|
||||
Event::End(Tag::Heading(..)) => break,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,6 +230,7 @@ fn t(input: &str, expect: &str) {
|
||||
t("code `let x = i32;` ...", "code `let x = i32;` ...");
|
||||
t("type `Type<'static>` ...", "type `Type<'static>` ...");
|
||||
t("# top header", "top header");
|
||||
t("# top header\n\nfollowed by some text", "top header");
|
||||
t("## header", "header");
|
||||
t("first paragraph\n\nsecond paragraph", "first paragraph");
|
||||
t("```\nfn main() {}\n```", "");
|
||||
|
||||
Reference in New Issue
Block a user