Skip to content

Commit eeac1af

Browse files
Adjust doctypes
Prettier v3 changed the behavior of <!DOCTYPE html> This change reverts this behavior
1 parent e9a9644 commit eeac1af

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/formatting/prettier/plugin.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ const plugin: prettier.Plugin = {
4242

4343
document.loadString(text);
4444

45-
const result = await (new PrettierDocumentFormatter(formatterOptions as prettier.ParserOptions))
45+
let result = await (new PrettierDocumentFormatter(formatterOptions as prettier.ParserOptions))
4646
.formatDocumentAsync(document, defaultAntlersSettings);
4747

48+
const adjustHtmlDoctype = /^(\s*)<!doctype html>/im;
49+
50+
result = result.replace(adjustHtmlDoctype, '$1<!DOCTYPE html>');
51+
4852
return {
4953
doc: document,
5054
result: result

0 commit comments

Comments
 (0)