Skip to content

Support htm #5552

@ikatyang

Description

@ikatyang

Ref: https://github.com/developit/htm#syntax-like-jsx-but-also-lit

  • the only incompatible part seems to be the closing tag for components <//>
  • we need to enable recognizeSelfClosing for HTML

Prettier 1.15.2
Playground link

--parser babylon

Input:

html`<${Footer}>footer content here<//>`

Output:

SyntaxError: Unexpected character "/" (1:70)
> 1 | <prettierhtmlplaceholder0redlohecalplmthreitterp>footer content here<//>
    |                                                                      ^                                                                 ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:multiparserIssues with printing one language inside another, like CSS-in-JSlang:htmlIssues affecting HTML (and SVG but not JSX)lang:javascriptIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.scope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependencystatus: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