Closed
Description
Similar to the previous bugs I've filed in this regard with illegal html:
In: 1.39.0-nightly (34e82a7 2019-09-10)
The following trait definition:
#[cfg_attr(
feature = "external_doc",
doc(include = "CacheFieldCollection.md")
)]
#[cfg_attr(
not(feature = "external_doc"),
doc = "An abstact representation of 'a thing' that can expose data \
about its unit."
)]
pub trait CacheFieldCollection {
/// Returns a struct containing data recorded for this thing
fn fields(&self) -> &CacheFieldData;
/// Returns a timestamp indicating time of last modification/update
fn mtime(&self) -> &chrono::DateTime<Utc>;
}
Emits invalid html ( hand formatted ):
<div class="docblock type-decl hidden-by-usual-hider">
<pre class='rust trait'>pub trait CacheFieldCollection {
fn <a href='#tymethod.fields' class='fnname'>fields</a>(&self) -> &<a class="struct" href="../ccache_stats_reader/struct.CacheFieldData.html" title="struct ccache_stats_reader::CacheFieldData">CacheFieldData</a>;
<div class='item-spacer'></div> fn <a href='#tymethod.mtime' class='fnname'>mtime</a>(&self) -> &<a class="struct" href="https://docs.rs/chrono/latest/chrono/datetime/struct.DateTime.html" title="struct chrono::datetime::DateTime">DateTime</a><<a class="struct" href="https://docs.rs/chrono/latest/chrono/offset/utc/struct.Utc.html" title="struct chrono::offset::utc::Utc">Utc</a>>;
}</pre></div>
"pre", like headers, only permits child nodes that are "phrasing content", of which, div is excluded.
So the error is from <div class='item-spacer'></div>
htmltidy
handles this by prematurely ending the <pre>
before the <div>
, and then reinserting a <pre>
afterwards, breaking layout: