Emit valid HTML from rustdoc
Previously, tidy-html5 (`tidy`) would complain about a few things in our HTML. The main thing is that `<summary>` tags can't contain `<div>`s. That's easily fixed by changing out the `<div>`s for `<span>`s with `display: block`. However, there's also a rule that `<span>`s can't contain heading elements. `<span>` permits only "phrasing content" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span, and `<h3>` (and friends) are "Flow content, heading content, palpable content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements We have a wrapping `<div>` that goes around each `<h3>`/`<h4>`, etc. We turn that into a `<section>` rather than a `<span>` because `<section>` permits "flow content". https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section After this change we get only three warnings from tidy, run on struct.String.html: line 6 column 10790 - Warning: trimming empty <span> line 1 column 1118 - Warning: <link> proprietary attribute "disabled" line 1 column 1193 - Warning: <link> proprietary attribute "disabled" The empty `<span>` is a known issue - there's a span in front of the search box to work around a strange Safari issue. The `<link>` attributes are the non-default stylesheets. We can probably refactor theme application to avoid using this proprietary "disabled" attribute.
This commit is contained in:
parent
1ea4851715
commit
32f62607c3
27 changed files with 127 additions and 133 deletions
|
@ -36,7 +36,7 @@ pub struct Foo<const N: usize> where u8: Trait<N>;
|
|||
// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)'
|
||||
pub struct Bar<T, const N: usize>([T; N]);
|
||||
|
||||
// @has foo/struct.Foo.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
|
||||
// @has foo/struct.Foo.html '//*[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
|
||||
impl<const M: usize> Foo<M> where u8: Trait<M> {
|
||||
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
|
||||
pub const FOO_ASSOC: usize = M + 13;
|
||||
|
@ -47,7 +47,7 @@ impl<const M: usize> Foo<M> where u8: Trait<M> {
|
|||
}
|
||||
}
|
||||
|
||||
// @has foo/struct.Bar.html '//div[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
|
||||
// @has foo/struct.Bar.html '//*[@id="impl"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
|
||||
impl<const M: usize> Bar<u8, M> {
|
||||
// @has - '//*[@id="method.hey"]' \
|
||||
// 'pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N>'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue