Skip to content

Commit

Permalink
rustdoc: avoid including <li> tags in item table short desc
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Feb 23, 2023
1 parent 07c993e commit 5a9a3df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> SummaryLine<'a, I> {
}

fn check_if_allowed_tag(t: &Tag<'_>) -> bool {
matches!(
t,
Tag::Paragraph | Tag::Item | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote
)
matches!(t, Tag::Paragraph | Tag::Emphasis | Tag::Strong | Tag::Link(..) | Tag::BlockQuote)
}

fn is_forbidden_tag(t: &Tag<'_>) -> bool {
Expand Down
1 change: 1 addition & 0 deletions tests/rustdoc/item-desc-list-at-start.item-table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.MY_CONSTANT.html" title="constant item_desc_list_at_start::MY_CONSTANT">MY_CONSTANT</a></div><div class="desc docblock-short">Groups: <code>SamplePatternSGIS</code>, <code>SamplePatternEXT</code></div></li></ul>
9 changes: 9 additions & 0 deletions tests/rustdoc/item-desc-list-at-start.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @has item_desc_list_at_start/index.html
// @count - '//ul[@class="item-table"]/li/div/li' 0
// @count - '//ul[@class="item-table"]/li' 1
// @snapshot item-table - '//ul[@class="item-table"]'

// based on https://docs.rs/gl_constants/0.1.1/src/gl_constants/lib.rs.html#16

/// * Groups: `SamplePatternSGIS`, `SamplePatternEXT`
pub const MY_CONSTANT: usize = 0;

0 comments on commit 5a9a3df

Please sign in to comment.