Skip to content

rustdoc generates HTML with "div" embedded in an h4 #60403

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
kentfredric opened this issue Apr 30, 2019 · 0 comments · Fixed by #60515
Closed

rustdoc generates HTML with "div" embedded in an h4 #60403

kentfredric opened this issue Apr 30, 2019 · 0 comments · Fixed by #60515
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@kentfredric
Copy link

kentfredric commented Apr 30, 2019

See also: #17529

Generating documentation for a struct with #[derive(Clone)] results in a page with an entry for clone_from with the following HTML:

<h4 id='method.clone_from' class="method">
<code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">
&amp;</a>Self)</code>
<div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div>
<a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a>
</h4>

As per remarks on aforementioned bug, the question "Have you confirmed that this doesn't break anything? Would you be able to host a rustdoc build to demonstrate?", the way this breaks for me is far worse than failing a validator test score:

I'm attempting to run the generated HTML though html-tidy, and upon seeing the <h4><div>...</div></h4> structure, warns:

line 9 column 3 - Warning: <div> isn't allowed in <h4> elements
line 9 column 67 - Warning: discarding unexpected </div>

It then appears to "Fix" this by rewriting it as:

<h4>...</h4><div>...</div><h4>...</h4>

And the resulting page is broken beyond usable.

N.B: htmltidy also complains about duplicate anchor names, as per #25001,

line 9 column 3 - Warning: <h4> anchor "method.clone_from" already defined

But that's a seperate issue, and I'd rather have a working HTML tidier so git diff produces something useful between iterations, and then I can more properly see what is going on there.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 30, 2019
Manishearth added a commit to Manishearth/rust that referenced this issue May 5, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants