rust/tests/rustdoc/sidebar/top-toc-html.rs
Michael Howell 1aebff96ad Add Top TOC support to rustdoc
This commit adds the headers for the top level documentation to
rustdoc's existing table of contents, along with associated items.

It only show two levels of headers. Going further would require the
sidebar to be wider, and that seems unnecessary (the crates that
have manually-built TOCs usually don't need deeply nested headers).
2024-08-20 16:27:42 -07:00

20 lines
762 B
Rust

// ignore-tidy-linelength
#![crate_name = "foo"]
#![feature(lazy_type_alias)]
#![allow(incomplete_features)]
//! # Basic [link](https://example.com) and *emphasis*
//!
//! This test case covers TOC entries with rich text inside.
//! Rustdoc normally supports headers with links, but for the
//! TOC, that would break the layout.
//!
//! For consistency, emphasis is also filtered out.
// @has foo/index.html
// User header
// @has - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-and-emphasis"]' 'Basic link and emphasis'
// @count - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-and-emphasis"]/em' 0
// @count - '//section[@id="TOC"]/ul[@class="block top-toc"]/li/a[@href="#basic-link-and-emphasis"]/a' 0