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:
parent
553852806d
commit
1bedd4d678
2 changed files with 2 additions and 0 deletions
|
@ -1124,6 +1124,7 @@ crate fn plain_text_summary(md: &str) -> String {
|
|||
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 test_plain_text_summary() {
|
|||
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```", "");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue