Rollup merge of #89506 - yaymukund:docblock-headings, r=GuillaumeGomez
librustdoc: Use correct heading levels. Closes #89309 This fixes the `<h#>` header tags throughout the docs to reflect a semantic hierarchy. - I ran a script to manually check that we don't have any files with multiple `<h1>` tags. - Also checked that we never incorrectly nest e.g. a `<h2>` under an `<h3>`. - I also spot-checked a bunch of pages (`trait.Read`, `enum.Ordering`, `primitive.isize`, `trait.Iterator`).
This commit is contained in:
commit
7d6feb421e
17 changed files with 264 additions and 122 deletions
|
|
@ -14,7 +14,7 @@ use std::path::PathBuf;
|
|||
|
||||
use rustc_span::edition::DEFAULT_EDITION;
|
||||
|
||||
use rustdoc::html::markdown::{ErrorCodes, IdMap, Markdown, Playground};
|
||||
use rustdoc::html::markdown::{ErrorCodes, HeadingOffset, IdMap, Markdown, Playground};
|
||||
|
||||
pub struct ErrorMetadata {
|
||||
pub description: Option<String>,
|
||||
|
|
@ -119,14 +119,15 @@ impl Formatter for HTMLFormatter {
|
|||
write!(
|
||||
output,
|
||||
"{}",
|
||||
Markdown(
|
||||
desc,
|
||||
&[],
|
||||
&mut id_map,
|
||||
ErrorCodes::Yes,
|
||||
DEFAULT_EDITION,
|
||||
&Some(playground)
|
||||
)
|
||||
Markdown {
|
||||
content: desc,
|
||||
links: &[],
|
||||
ids: &mut id_map,
|
||||
error_codes: ErrorCodes::Yes,
|
||||
edition: DEFAULT_EDITION,
|
||||
playground: &Some(playground),
|
||||
heading_offset: HeadingOffset::H1,
|
||||
}
|
||||
.into_string()
|
||||
)?
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue