Skip to content

Commit

Permalink
Format doctype as lowercase to match Prettier 3.0 (#370)
Browse files Browse the repository at this point in the history
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
  • Loading branch information
lucaseverett and Princesseuh authored Aug 21, 2023
1 parent 701fbd3 commit b806845
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-ears-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"prettier-plugin-astro": patch
---

Format doctype as lowercase to match Prettier 3.0
2 changes: 1 addition & 1 deletion src/printer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export function print(path: AstPath, opts: ParserOptions, print: printFn): Doc {

case 'doctype': {
// https://www.w3.org/wiki/Doctypes_and_markup_styles
return ['<!DOCTYPE html>', hardline];
return ['<!doctype html>', hardline];
}

case 'comment':
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/basic/basic-html/output.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let title = "My Site";
const colors = ["red", "yellow", "blue"];
---

<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>My site</title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let title = "My Site";
const colors = ["red", "yellow", "blue"];
---

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>My site</title>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/other/fragment/output.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down

0 comments on commit b806845

Please sign in to comment.