Treat header as first paragraph for shortened markdown descriptions
"The Rust Standard LibraryThe Rust Standard Library is the …" is an awful description.
This commit is contained in:
parent
3a5d45f68c
commit
e40b3d6a38
@ -1093,6 +1093,7 @@ fn push(s: &mut String, text_length: &mut usize, text: &str) {
|
||||
Tag::Emphasis => s.push_str("</em>"),
|
||||
Tag::Strong => s.push_str("</strong>"),
|
||||
Tag::Paragraph => break,
|
||||
Tag::Heading(..) => break,
|
||||
_ => {}
|
||||
},
|
||||
Event::HardBreak | Event::SoftBreak => {
|
||||
|
@ -235,6 +235,7 @@ fn t(input: &str, expect: &str) {
|
||||
t("code `let x = i32;` ...", "code <code>let x = i32;</code> …");
|
||||
t("type `Type<'static>` ...", "type <code>Type<'static></code> …");
|
||||
t("# top header", "top header");
|
||||
t("# top header\n\nfollowed by a paragraph", "top header");
|
||||
t("## header", "header");
|
||||
t("first paragraph\n\nsecond paragraph", "first paragraph");
|
||||
t("```\nfn main() {}\n```", "");
|
||||
|
Loading…
Reference in New Issue
Block a user