Skip to content

📝 Prettier has special treatment of class, style attributes #5242

Activity

  1. added
    L-HTMLLanguage: HTML and super languages
    S-Bug-confirmedStatus: report has been confirmed as a valid bug
    on Mar 2, 2025
  2. added theissue type on Mar 2, 2025
  3. dyc3 commented on Jun 10, 2025

    @dyc3
    ContributorAuthor

    I've actually figured out why our playground doesn't show the behavior. Our playground disables prettier's embeddedLanguageFormatting, and prettier considers the these attributes as embedded languages.

    class attribute: https://github.com/prettier/prettier/blob/0fe055c25d7e8b74bab35c188ee9bb3de4c23fa5/src/language-html/embed/class-names.js
    style attribute: https://github.com/prettier/prettier/blob/0fe055c25d7e8b74bab35c188ee9bb3de4c23fa5/src/language-html/embed/style.js

    This makes more sense for the style attribute, where it actually invokes the CSS parser and formatter to format the text.

  4. added this to the HTML Stablization milestone on Oct 27, 2025
  5. assigned and unassigned on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-FormatterArea: formatterL-HTMLLanguage: HTML and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions