wjdp / htmltest

:white_check_mark: Test generated HTML for problems
MIT License
323 stars 54 forks source link

Anchors in `pre` tags are raising errors. #163

Closed themr0c closed 3 years ago

themr0c commented 3 years ago

Describe the bug

Anchors in pre tags are raising errors.

To Reproduce

Steps to reproduce the behaviour:

  1. Run with config and options …
  2. Scroll down to '....'
  3. See error

.htmltest.yml

Non impacting.

Source files

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html>

<pre><span id="ABCDE" />1</span></pre>
<a href="#ABCDE">1</a>

<span id="FGHIJ" />2</span>
<a href="#FGHIJ">2</span>

Expected behaviour

No errors (as the second anchornot in a pre tag).

Actual behaviour

htmltest test-snippet.html
htmltest started at 08:31:42 on .
========================================================================
test-snippet.html
  hash does not exist --- test-snippet.html --> #ABCDE
========================================================================
✘✘✘ failed in 291.944489ms
1 errors

Versions

Additional context

wjdp commented 3 years ago

Dug into this, the problem is we are currently ignoring all html inside pre and code tags. This seems to have been a mistake as HTML is very much valid in these tags.