diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:37 +0000 |
commit | 246f239d9f40f633160f0c18f87a20922d4e77bb (patch) | |
tree | 5a88572663584b3d4d28e5a20e10abab1be40884 /src/librustdoc/html/markdown.rs | |
parent | Releasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip |
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/librustdoc/html/markdown.rs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 52a2effca..43d07d4a5 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -330,34 +330,27 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> { }); let tooltip = if ignore != Ignore::None { - Some((None, "ignore")) + highlight::Tooltip::Ignore } else if compile_fail { - Some((None, "compile_fail")) + highlight::Tooltip::CompileFail } else if should_panic { - Some((None, "should_panic")) + highlight::Tooltip::ShouldPanic } else if explicit_edition { - Some((Some(edition), "edition")) + highlight::Tooltip::Edition(edition) } else { - None + highlight::Tooltip::None }; // insert newline to clearly separate it from the // previous block so we can shorten the html output let mut s = Buffer::new(); s.push_str("\n"); - highlight::render_with_highlighting( + + highlight::render_example_with_highlighting( &text, &mut s, - Some(&format!( - "rust-example-rendered{}", - if let Some((_, class)) = tooltip { format!(" {}", class) } else { String::new() } - )), - playground_button.as_deref(), tooltip, - edition, - None, - None, - None, + playground_button.as_deref(), ); Some(Event::Html(s.into_inner().into())) } @@ -1126,7 +1119,11 @@ impl MarkdownSummaryLine<'_> { let mut s = String::new(); - html::push_html(&mut s, LinkReplacer::new(SummaryLine::new(p), links)); + let without_paragraphs = LinkReplacer::new(SummaryLine::new(p), links).filter(|event| { + !matches!(event, Event::Start(Tag::Paragraph) | Event::End(Tag::Paragraph)) + }); + + html::push_html(&mut s, without_paragraphs); s } @@ -1446,6 +1443,8 @@ fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> { map.insert("not-displayed".into(), 1); map.insert("alternative-display".into(), 1); map.insert("search".into(), 1); + map.insert("crate-search".into(), 1); + map.insert("crate-search-div".into(), 1); // This is the list of IDs used in HTML generated in Rust (including the ones // used in tera template files). map.insert("mainThemeStyle".into(), 1); @@ -1453,7 +1452,6 @@ fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> { map.insert("settings-menu".into(), 1); map.insert("help-button".into(), 1); map.insert("main-content".into(), 1); - map.insert("crate-search".into(), 1); map.insert("toggle-all-docs".into(), 1); map.insert("all-types".into(), 1); map.insert("default-settings".into(), 1); |