-
Notifications
You must be signed in to change notification settings - Fork 11
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
HTML validation errors #280
Comments
After short research changing this div to span would fix at least problems with div inside pre tag (plus changing div to span in $end_tags - line 485). There still would be a problem with style block. That should be much higher I guess. |
In regards to the <!DOCTYPE html>
<html lang=en>
<head>
<title>Test</title>
</head>
<body>
<style>body { color:green }</style>
</body>
</html> This also is marked as an error: However, this is not correct. See the HTML spec where it says |
Changing the
That should be doable, even though it's not strictly necessary, as browsers render it just fine. Doing so would also involve changing this CSS: syntax-highlighting-code-block/style.css Lines 6 to 8 in 91ae9d7
To something like this: .wp-block-code > span {
overflow: auto;
display: block;
} |
About style tag: Here is WHATWG spec about style tag. There is no info about putting style into body. That's why W3C Validator complains about it. It follows WHATWG rules under the hood. So I would say that the only valid place for style tag is head. About div inside pre: To sum up, of course, you're right. Most browsers should ignore these cases and render everything as expected. But I would follow official recommendations and stick to standards. For example putting style to head is the most acceptable choice, no validator will complain. Question is if it's possible to achieve with current approach? |
Strange that the W3C Validator is following the WHATWG version of the spec, and not the W3C's own version. 🤷 See also the whatwg/html#1605 for the discussion about adding The reality is that WordPress core outputs styles in the The WHATWG spec doesn't allow Whenever a stylesheet is enqueued after In short, there's no way reliable move the
The |
Fair enough, it seems to be overkill to implement something like this. Coming back to |
@brokul-dev See the reasoning behind the extra |
I've created a pull request for that: #285 |
Hi!
I've noticed that there are some html validation errors related to this plugin. Am I doing something wrong or this is how it should work?
This is html structure of "code blocks":
The text was updated successfully, but these errors were encountered: