Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix excess warnings about <style> outside of <head> #1135

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

hills
Copy link

@hills hills commented Feb 21, 2025

Hopefully to do the right thing with #730, see notes in the commit message.

There is no way to silence warnings [*]:

> $ tidy -q -e foo.html
> line 7 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.

> $ tidy -q -e --fix-style-tags no foo.html
> line 7 column 9 - Warning: found <style> tag in <body>! fix-style-tags: yes to move.

As far as I can find, there was potential that <style> would be allowed
here and this never happened.

So I think defaulting "yes" is the root problem here.

This patch makes the behaviour more like existing tags. By default raise
a warning; when a tag is misplaced. The addition of "fix-style-tags:
yes" automatically fixes it and silences the warning.

I also considered to warn about the behaviour until the user expresses
their intention with fix-style-tags. This was suggested in [*] but
cfgBool() as no way to return 'unset', and the chosen solution seems
"more correct".

Downside of this patch is it changes behaviour, seen in patches to
regression test 6_1_1_2.

[*] htacg#730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant