You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Special nature of DOCTYPE: It's important to note that the DOCTYPE is not an HTML tag, but rather a required preamble. Its unique status as a declaration rather than a tag makes it a special case in HTML documents, which some argue warrants special consideration in formatting.
Flexibility: Different developers and teams have different preferences regarding code style. Adding this option will allow for customization of formatting to individual or team coding standards.
Backward compatibility: The preserve option will allow maintaining existing style in projects that don't want to introduce changes in DOCTYPE casing.
Resolving controversy: There are differing opinions in the community about the preferred DOCTYPE casing. Adding this option will allow reconciling different preferences without imposing a single style on all users.
The proposed implementation does not violate Prettier's opinionated principle as it concerns a purely stylistic aspect that does not affect the functionality or semantics of HTML code.
Prettier 3.3.3
Input:
Output:
Expected output:
Depends on the --doctype-case option setting:
For
--doctype-case lowercase(can be default):For --doctype-case uppercase:
For
--doctype-case preserve:Why?
Proposal to add a new configuration option
--doctype-caseto allow users to choose their preferred DOCTYPE casing style.<!DOCTYPE html>, case-insensitively." This suggests that uppercase is the canonical form, which some developers prefer to follow strictly. https://html.spec.whatwg.org/multipage/syntax.html#the-doctypeThe proposed implementation does not violate Prettier's opinionated principle as it concerns a purely stylistic aspect that does not affect the functionality or semantics of HTML code.