FG
๐Ÿ’ป Software๐Ÿ› ๏ธ Developer Tools

HTML TODOs

Fresh3 days ago
Mar 14, 20260 views
Confidence Score88%
88%

Problem

This issue tracks HTML issues that should be done before the public release. --- Please take a look at #5259, which should address this issue. --- Try out the current experimental HTML support: [code block] or preview playground in #5135. --- | icon | description | |-|-| | โœ”๏ธ | merged | | ๐Ÿ‘€ | in review | | ๐Ÿ”œ | #5259 | | ๐Ÿƒ | WIP | --- Features - [x] support front matter - #5110 - [ ] support pragma - ๐Ÿ”œ - [x] unambiguous/XHTML-compatible output for void tags (e.g., `<br />`) (reason) - #5116 - [ ] html in js template literal (comment) - ๐Ÿ”œ - [x] whitespace-sensitive formatting (comment) - #5168 - [ ] recognize CDATA (comment) - ๐Ÿ”œ - template languages - [ ] format interpolation `{{ js expression }}` (comment) - ๐Ÿ”œ - ~~maybe support bracketSpacing?~~ (no, it's not supported in JSX) - Angular - [ ] format attribute binding syntax (`*ngIf`, `[target]`, `(target)`, `[(target)]`) - ๐Ÿ”œ - [ ] format inline template (``@Component({ template: `html` })``) - ๐Ÿ”œ - Vue - [ ] format attribute binding syntax (`:class`, `v-if`, `v-bind:id`, `@click`) - ๐Ÿ”œ Bug fixes - [x] ~~exclude comments from fragment detection~~ (outdated) - #5100 - [x] remove extra trailing newline for `<template>` (repro) - #5127 - [x] add missing trailing newline for `<style>` (repro) - #5111 - [x] preserve HTML entities - ~~#5119~~ #5127 - [x] preserve case-sensitive tags - #5101 - [x] preserve case-sensitive attributes - #51

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Implement Missing HTML Features Before Release

Medium Risk

The current HTML implementation lacks support for several features such as pragma, HTML in JS template literals, and various attribute binding syntaxes in Angular and Vue. These missing features may lead to improper formatting and functionality issues in the final product, affecting user experience.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Implement Support for Pragma

    Add functionality to recognize and properly handle pragma directives in HTML. This will ensure that any special processing required by the pragma is executed correctly.

    javascript
    // Example of pragma usage
    /* @pragma some-directive */
  2. 2

    Enable HTML in JS Template Literals

    Modify the parser to allow HTML to be embedded within JavaScript template literals. This will enhance the flexibility of using HTML within JavaScript code.

    javascript
    const template = `
      <div>
        <h1>Hello World</h1>
      </div>`;
  3. 3

    Format Angular Attribute Binding Syntax

    Implement formatting for Angular attribute binding syntaxes such as `*ngIf`, `[target]`, `(target)`, and `[(target)]`. This will ensure that Angular templates are formatted correctly and are functional.

    html
    <div *ngIf="condition">Content</div>
  4. 4

    Format Vue Attribute Binding Syntax

    Add support for formatting Vue attribute binding syntaxes like `:class`, `v-if`, `v-bind:id`, and `@click`. This will improve the integration of Vue components and enhance readability.

    html
    <div :class="{'active': isActive}" @click="handleClick">Click Me</div>
  5. 5

    Recognize CDATA Sections

    Implement functionality to recognize and properly handle CDATA sections in HTML. This is important for ensuring that special characters within CDATA are not processed as markup.

    html
    <![CDATA[ <div>Some content</div> ]]>

Validation

Confirm that all new features are functioning as expected by running unit tests and manually testing the HTML output in various scenarios. Ensure that the output is valid and adheres to the expected formatting rules.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

prettierformattingjavascriptstatus:has-prlang:htmllocked-due-to-inactivity