Skip to content

HTML Templating requires unquoted attributes #5627

@ntotten

Description

@ntotten

HTML supports unquoted attributes, we use a template language that uses unquoted attributes for templating and requires template attributes to NOT have templates. It would be ideal to support an option to not surround attributes with quotes.

Alternatively, having a "sub" HTML syntax like is done with Vue would work as well. We'd prefer to avoid forking the entire HTML plugin just to change this single format if possible.

Prettier 1.15.3
Playground link

--parser html

Input:

<div>
  <p id={VALUE}>Hello</p>
</div>

Output:

<div><p id="{VALUE}">Hello</p></div>

Expected behavior:
The attribute should not be surrounded by quotes.

<div><p id={VALUE}>Hello</p></div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:htmlIssues affecting HTML (and SVG but not JSX)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions