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

📝 HTML Formatter Bug: Extra spaces inserted in quoted attributes #4926

Open
1 task done
Enoumy opened this issue Jan 20, 2025 · 1 comment
Open
1 task done

📝 HTML Formatter Bug: Extra spaces inserted in quoted attributes #4926

Enoumy opened this issue Jan 20, 2025 · 1 comment
Labels
A-Formatter Area: formatter good first issue Good for newcomers L-HTML Language: HTML S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@Enoumy
Copy link

Enoumy commented Jan 20, 2025

Environment information

CLI:
  Version:                      0.0.0
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  NO_COLOR:                     unset
  TERM:                         "tmux-256color"
  JS_RUNTIME_VERSION:           unset
  JS_RUNTIME_NAME:              unset
  NODE_PACKAGE_MANAGER:         unset

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Formatter:
  Format with errors:           false
  Indent style:                 Tab
  Indent width:                 2
  Line ending:                  Lf
  Line width:                   80
  Attribute position:           Auto
  Bracket spacing:              BracketSpacing(true)
  Ignore:                       ["configuration_schema.json"]
  Include:                      []

JavaScript Formatter:
  Enabled:                      true
  JSX quote style:              Double
  Quote properties:             AsNeeded
  Trailing commas:              All
  Semicolons:                   Always
  Arrow parentheses:            Always
  Bracket spacing:              unset
  Bracket same line:            false
  Quote style:                  Double
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Attribute position:           unset

JSON Formatter:
  Enabled:                      false
  Indent style:                 Space
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   1
  Trailing Commas:              unset

CSS Formatter:
  Enabled:                      true
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Quote style:                  Double

GraphQL Formatter:
  Enabled:                      false
  Indent style:                 unset
  Indent width:                 unset
  Line ending:                  unset
  Line width:                   unset
  Bracket spacing:              unset
  Quote style:                  unset

Workspace:
  Open Documents:               0

Configuration

Playground link

https://biomejs.dev/playground/?indentStyle=space&indentWidth=4&bracketSameLine=true&files.main.html=PABkAGkAdgAgAGEAdAB0AHIAPQBpAC0AYQBtAC0AbwBrAD4APAAvAGQAaQB2AD4ACgA8AGQAaQB2ACAAYQB0AHQAcgA9AGkALQBoAGEAdgBlAC0AYQBuAC0AZQB4AHQAcgBhAC0AcwBwAGEAYwBlACAAYQBuAG8AdABoAGUAcgBfAGEAdAB0AHIAPgA8AC8AZABpAHYAPgAKADwAZABpAHYAIABhAHQAdAByAD0AaQAtAGgAYQB2AGUALQBtAHUAbAB0AGkAcABsAGUALQBlAHgAdAByAGEALQBzAHAAYQBjAGUAcwAgACAAIAAgACAAYQBuAG8AdABoAGUAcgBfAGEAdAB0AHIAPgA8AC8AZABpAHYAPgAKADwAZABpAHYAIABhAHQAdAByAD0AaQAtAGEAbABzAG8ALQBoAGEAdgBlAC0AYQBuAC0AZQB4AHQAcgBhAC0AcwBwAGEAYwBlACAAPgA8AC8AZABpAHYAPgAKAA%3D%3D

Code of Conduct

  • I agree to follow Biome's Code of Conduct
@Enoumy Enoumy added the S-Needs triage Status: this issue needs to be triaged label Jan 20, 2025
@Enoumy
Copy link
Author

Enoumy commented Jan 20, 2025

Hi! Thank you for biome! I am really happy at how fast it is. I have a bug report that I came across while I was experimenting with the early experimental-html formatter. I looked around some of the existing Github issues and did not find an already existing report for this though please feel free to mark it as a duplicate in case I missed something.

The bug is that the below segment:

<div attr=i-am-ok></div>
<div attr=i-have-an-extra-space another_attr></div>
<div attr=i-have-multiple-extra-spaces     another_attr></div>
<div attr=i-also-have-an-extra-space ></div>

gets formatted into:

<div attr="i-am-ok"></div>
<div attr="i-have-an-extra-space " another_attr></div>
<div attr="i-have-multiple-extra-spaces     " another_attr></div>
<div attr="i-also-have-an-extra-space "></div>

note the additional whitespace after some of the semi-colons that change the the attribute value strings to have extra trailing whitespace.

I have included a playground link here that reproduces the issue.

I am happy to answer any questions you may have/provide additional context.

@dyc3 dyc3 added A-Formatter Area: formatter L-HTML Language: HTML S-Bug-confirmed Status: report has been confirmed as a valid bug labels Jan 20, 2025
@github-actions github-actions bot removed the S-Needs triage Status: this issue needs to be triaged label Jan 20, 2025
@dyc3 dyc3 added the good first issue Good for newcomers label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter good first issue Good for newcomers L-HTML Language: HTML S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

2 participants