Files
rust/tests/rustdoc-ui/lints
Jacob Pratt 3fc9b07570 Rollup merge of #158709 - notriddle:html-lint-interleaving, r=camelid,GuillaumeGomez
rustdoc: warn on improperly interleaved HTML/MD

Enhances the `rustdoc::invalid_html_tags` lint to warn in cases where pulldown-cmark will produce invalid HTML because the Markdown and HTML are improperly nested.

As an extreme example, this code does not do what it looks like it does, and it doesn't produce a warning under current nightly, either:

```markdown
Figure 1: an X
<svg viewBox="0 0 10 10">
<path
    d="M0 10L10 0M10 10L0 0"
    stroke="black"
>
</svg>
```

This pull request makes it warn:

```text
error: unopened HTML tag `svg`
  --> $DIR/invalid-html-tags.rs:285:5
   |
LL | /// <svg viewBox="0 0 10 10">
   |     ---- does not match this unclosed tag
...
LL | /// >
   |     - because the Markdown paragraph is interrupted by this block quote
LL | /// </svg>
   |     ^^^^^^ this unopened tag
```

See also: https://talk.commonmark.org/t/thoughts-on-changing-supported-html-syntax-to-include-the-dangling-closing-angle-bracket/3827
2026-07-26 00:21:40 -04:00
..
2026-07-18 12:09:58 +03:00
2026-07-18 12:09:58 +03:00
2026-07-18 12:09:58 +03:00
2026-07-10 21:13:04 -07:00
…