diff --git a/crates/mdbook-html/front-end/templates/toc.js.hbs b/crates/mdbook-html/front-end/templates/toc.js.hbs
index d5be5b1189..8add441acb 100644
--- a/crates/mdbook-html/front-end/templates/toc.js.hbs
+++ b/crates/mdbook-html/front-end/templates/toc.js.hbs
@@ -336,10 +336,17 @@ window.customElements.define('mdbook-sidebar-scrollbox', MDBookSidebarScrollbox)
});
}
- // Takes the nodes from the given head and copies them over to the
- // destination, along with some filtering.
+ // Takes the rendered content of the given heading and copies it over to
+ // the destination, along with some filtering.
function filterHeader(source, dest) {
const clone = source.cloneNode(true);
+ // Unwrap the injected permalink anchor (`link"})
+
+// A heading whose entire content is a link should still show its text.
+assert-text: ("a.header-in-summary[href='#link-only']", "link-only")
+
// Clicking the custom one should work and should make it current.
click: "a.header-in-summary[href='#custom-id']"
assert-count: (".current-header", 1)