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

Configurable position and order of HTML attributes #2222

Open
Casimodo72 opened this issue Nov 15, 2023 · 0 comments
Open

Configurable position and order of HTML attributes #2222

Casimodo72 opened this issue Nov 15, 2023 · 0 comments

Comments

@Casimodo72
Copy link

Description

Would a configuration of the position and order of HTML attributes be possible?

Context: I've used XamlStyler (well, it's for XAML not HTML) for over a year in a previous job and found that it produced the most readable, compact and consistent markup format - for our team at least.
Now I'm missing that for HTML.
Here's XamlStyler's attribute reordering Wiki for a quick look.

Input

E.g., if one writes HTML without thinking:

<img x-custom-attr-1="..." alt="..." class="..." [src]="..." id="..." />

Now, we would like some attributes to always appear on the line of the tag ("class" and "id").
Every following attribute would appear on a new line in the following order:

  1. Angular bindings ("[*]")
  2. built-in HTML attributes (i.e. not custom attributes)
  3. specific custom attributes ("x-*")

All of this is currently configurable with XamlStyler (for XAML).

Expected Output

The formatted HTML would be:

<img class="..." id="..."
    [src]="..."
    alt="..."
    x-custom-attr-1="..." />

Environment

OS: all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant