Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent doctype case formatting #3358

Closed
MrDanielHarka opened this issue Mar 31, 2024 · 6 comments
Closed

Inconsistent doctype case formatting #3358

MrDanielHarka opened this issue Mar 31, 2024 · 6 comments
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@MrDanielHarka
Copy link

No, I don't have a preference if the doctype is lowercase or uppercase, like the below mentions:

I really don't care. But please make it at least consistent. Now I get changes in git just because Prettier formats it inconsistently.

Prettier v10.4.0

Case 1: Prettier auto-formatting in VSCode with extension.

Input:

<!doctype html>

Output:

<!DOCTYPE html>

Case 2: Prettier CLI formatting using bunx prettier index.html

Input:

<!DOCTYPE html>

Output:

<!doctype html>

Expected behavior:
The two tools should have the same case formatting for the doctype tag, whichever it is.

@studioswong
Copy link

Seconding this issue as I had just experienced the same while formatting my code via the CLI, and was confused about the discrepancy - what is the prettier's team's recommendation on this? ( I noticed multiple discussions on the debate between uppercase and lowercase, including this one - while my understanding is that the prettier team recommends lowercase and enforces it by default back in 2019, I wonder is this still the case now?)

@eligrey
Copy link

eligrey commented May 9, 2024

Lowercase is invalid XML. This shouldn't be difficult to resolve.

@omichel
Copy link

omichel commented Jun 21, 2024

I found the reason for this problem: it seems that the Prettier VSCode plugin version 10.4.0 uses Prettier version 2.8.8 whereas the latest version of Prettier is 3.3.2 (as of today). Prettier 2.8.8 produces <!DOCTYPE html> whereas version 3.3.2 produces <!doctype html>. If you want the CLI version to match with the VSCode plugin, you should install Prettier 2.8.8 CLI. See details.

@ntotten
Copy link
Member

ntotten commented Aug 14, 2024

The vscode extension resolves the local version of prettier if there is one, otherwise it falls back to 2.8.8. It is recommended that you install prettier in your project to keep the results consistent.

@ntotten ntotten closed this as completed Aug 14, 2024
@infanasotku
Copy link

The vscode extension resolves the local version of prettier if there is one, otherwise it falls back to 2.8.8. It is recommended that you install prettier in your project to keep the results consistent.

Thanks! It works fine for me.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Jan 29, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

6 participants