rustdoc_to_markdown: Strip "Copy item path to clipboard" button (#12490)

This PR strips the "Copy item path to clipboard" button from the rustdoc
output.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-05-30 12:55:37 -04:00 committed by GitHub
parent 8f942bf647
commit 39a2cdb13f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View file

@ -44,6 +44,27 @@ mod tests {
use super::*;
#[test]
fn test_main_heading_buttons_get_removed() {
let html = indoc! {r##"
<div class="main-heading">
<h1>Crate <a class="mod" href="#">serde</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1>
<span class="out-of-band">
<a class="src" href="../src/serde/lib.rs.html#1-340">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span></span>]</button>
</span>
</div>
"##};
let expected = indoc! {"
# Crate serde
"}
.trim();
assert_eq!(
convert_rustdoc_to_markdown(html.as_bytes()).unwrap(),
expected
)
}
#[test]
fn test_rust_code_block() {
let html = indoc! {r#"