rustdoc: don't give depreciation notes special handling

This commit is contained in:
binarycat
2025-12-12 14:38:01 -06:00
parent 8c52f735ab
commit 438b126177
4 changed files with 13 additions and 7 deletions
+7 -5
View File
@@ -109,13 +109,15 @@ pub(crate) struct MarkdownWithToc<'a> {
pub(crate) edition: Edition,
pub(crate) playground: &'a Option<Playground>,
}
/// A tuple struct like `Markdown` that renders the markdown escaping HTML tags
/// A struct like `Markdown` that renders the markdown escaping HTML tags
/// and includes no paragraph tags.
pub(crate) struct MarkdownItemInfo<'a> {
pub(crate) content: &'a str,
pub(crate) links: &'a [RenderedLink],
pub(crate) ids: &'a mut IdMap,
}
/// A tuple struct like `Markdown` that renders only the first paragraph.
pub(crate) struct MarkdownSummaryLine<'a>(pub &'a str, pub &'a [RenderedLink]);
@@ -1497,10 +1499,10 @@ pub(crate) fn write_into(self, mut f: impl fmt::Write) -> fmt::Result {
let p = SpannedLinkReplacer::new(p, links);
let p = footnotes::Footnotes::new(p, existing_footnotes);
let p = TableWrapper::new(p.map(|(ev, _)| ev));
let p = p.filter(|event| {
!matches!(event, Event::Start(Tag::Paragraph) | Event::End(TagEnd::Paragraph))
});
html::write_html_fmt(&mut f, p)
// in legacy wrap mode, strip <p> elements to avoid them inserting newlines
html::write_html_fmt(&mut f, p)?;
Ok(())
})
}
}
+1 -1
View File
@@ -472,7 +472,7 @@ fn t(input: &str, expect: &str) {
let mut idmap = IdMap::new();
let mut output = String::new();
MarkdownItemInfo::new(input, &[], &mut idmap).write_into(&mut output).unwrap();
assert_eq!(output, expect, "original: {}", input);
assert_eq!(output, format!("<p>{}</p>\n", expect), "original: {}", input);
}
t("`Struct<'a, T>`", "<code>Struct&lt;'a, T&gt;</code>");
@@ -1585,7 +1585,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
color: var(--main-color);
background-color: var(--stab-background-color);
width: fit-content;
white-space: pre-wrap;
border-radius: 3px;
display: inline;
vertical-align: baseline;
+5
View File
@@ -30,3 +30,8 @@
// 'Deprecated: shorthand reason: code$'
#[deprecated = "shorthand reason: `code`"]
pub struct X;
//@ matches deprecated/struct.Y.html '//*[@class="stab deprecated"]//p[1]' 'multiple'
//@ matches deprecated/struct.Y.html '//*[@class="stab deprecated"]//p[2]' 'paragraphs'
#[deprecated = "multiple\n\nparagraphs"]
pub struct Y;