Open dyc3 opened 1 month ago
@dyc3 Hi, I dug this issue a bit and I suppose it's the common problem for all HTML tags.
Here's the example with <DIV></DIV>
Just exploring at the moment, not committing into the fix.
When the html
directive in an HTML file is lowercase, Prettier outputs <!doctype>
. Otherwise, it outputs <!DOCTYPE>
in uppercase. See here
function printOpeningTagStartMarker(node) {
switch (node.type) {
case "ieConditionalComment":
case "ieConditionalStartComment":
return `<!--[if ${node.condition}`;
case "ieConditionalEndComment":
return "<!--<!";
case "interpolation":
return "{{";
case "docType":
return node.value === "html" ? "<!doctype" : "<!DOCTYPE";
case "angularIcuExpression":
return "{";
case "element":
if (node.condition) {
return `<!--[if ${node.condition}]><!--><${node.rawName}`;
}
// fall through
default:
return `<${node.rawName}`;
}
}
BTW, in the playground, if the doctype
is not entirely uppercase or lowercase, Biome
throws an format error, but Prettier
doesn't.
Environment information
Configuration
No response
Playground link
https://biomejs.dev/playground/?quoteStyle=single&indentWidth=4&arrowParentheses=as-needed&files.main.html=PAAhAGQAbwBjAHQAeQBwAGUAIABIAFQATQBMAD4ACgA%3D
Code of Conduct