peterbe / premailer

Turns CSS blocks into style attributes
https://premailer.io
BSD 3-Clause "New" or "Revised" License
1.06k stars 188 forks source link

Question about self-closing tags #263

Open pavel-mikhadyuk-redshelf opened 2 years ago

pavel-mikhadyuk-redshelf commented 2 years ago

I used premailer==3.6.1 on the project. And the html which is passed to transform method has self-enclosing tags but premailer turns them in tags omitted end tag. I would not notice that but I used https://validator.w3.org/ for checking result html For example,

Error Line 4, Column 72: end tag for "meta" omitted, but OMITTAG NO was specified

✉ You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">". Also doctype declaration was omitted in the result html.

I use such structure:

<!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    ...
</head>

<body>
...
</body>
</html>

Q: - Are there ways for keeping end tag in self-closing tags and doctype in the result html after premailer handling?

peterbe commented 2 years ago

I honestly don't know. What does premailer do? Does it spit out

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

or

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

or

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>