Skip to content

Docs: Note multi-attribute wrap behavior on maxLineLength#1823

Merged
marcoroth merged 1 commit into
marcoroth:mainfrom
andy-rootly:docs/formatter-attribute-wrap-note
Jun 28, 2026
Merged

Docs: Note multi-attribute wrap behavior on maxLineLength#1823
marcoroth merged 1 commit into
marcoroth:mainfrom
andy-rootly:docs/formatter-attribute-wrap-note

Conversation

@andy-rootly

@andy-rootly andy-rootly commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

The formatter wraps tags one-attribute-per-line under two conditions (see attribute-renderer.ts#L91):

  1. The opening tag would exceed maxLineLength, OR
  2. The tag has more than 3 attributes

Only the first is documented today. The second can be surprising in practice — <div a="1" b="2" c="3" d="4"> wraps even though it's 36 characters wide, well under the 80-char default. This PR adds a short note on the maxLineLength option flagging the count rule.

The docs site (docs/docs/projects/formatter.md) @includes this README, so herb-tools.dev picks the change up automatically.

The formatter wraps tags with more than 3 attributes one-per-line
regardless of maxLineLength. Surface this on the maxLineLength option
so users aren't surprised when short multi-attribute tags wrap.

Refs marcoroth#928

@marcoroth marcoroth left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andy-rootly! 🙏🏼

I wonder if we should reconsider this rule and only wrap the attributes when they wouldn't fit within the maxLineLength.

I'm open to suggestions.

@marcoroth marcoroth changed the title Docs: Note multi-attribute wrap behavior on maxLineLength Docs: Note multi-attribute wrap behavior on maxLineLength Jun 28, 2026
@marcoroth marcoroth merged commit c642f23 into marcoroth:main Jun 28, 2026
1 check passed
@andy-rootly

Copy link
Copy Markdown
Contributor Author

I wonder if we should reconsider this rule and only wrap the attributes when they wouldn't fit within the maxLineLength.

Yeah, that make sense to me: #1834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants