diff options
| author | Michael Howell <michael@notriddle.com> | 2021-02-20 16:45:56 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2021-02-20 16:48:37 -0700 |
| commit | 1bedd4d6781aaf5e45d19b1f85db6cc28bfd2f4e (patch) | |
| tree | 7724700c6333dc5e1c0a82a05a1c3d9ea9568092 /src | |
| parent | 553852806dfea7b9d8fb03a1ca4f51d8e31b3a3c (diff) | |
| download | rust-1bedd4d6781aaf5e45d19b1f85db6cc28bfd2f4e.tar.gz rust-1bedd4d6781aaf5e45d19b1f85db6cc28bfd2f4e.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 1 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown/tests.rs | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index a81fd55f6f1..b7854bbf82b 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -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, _ => (), } } diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs index 9da3072ec28..994fe8206e8 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -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```", ""); |
