872 B
872 B
Keep doctype in non-html files unchanged (#16765 by @fisker)
In Prettier v3, we print HTML5 doctype in lowercase, it's safe for HTML files, however users may use the html parser to format other files eg: XHTML files, lowercase the doctype will break XHTML documents.
Since Prettier main, we'll only lowercase HTML5 doctype (<!doctype html>) when the file extension is .html or .htm, otherwise they will be untouched.
<!-- Input -->
<!-- foo.xhtml -->
<!DOCTYPE html>
<!-- Prettier stable -->
<!doctype html>
<!-- Prettier main -->
<!DOCTYPE html>