Skip to content

Formatter: Fix ERB text flow formatting to keep adjacent inline elements together#1010

Open
ydah wants to merge 1 commit intomarcoroth:mainfrom
ydah:903
Open

Formatter: Fix ERB text flow formatting to keep adjacent inline elements together#1010
ydah wants to merge 1 commit intomarcoroth:mainfrom
ydah:903

Conversation

@ydah
Copy link
Contributor

@ydah ydah commented Dec 25, 2025

Fixes: #903

@navidemad
Copy link

Really nice feature :)

@marcoroth marcoroth changed the title Fix ERB text flow formatting to keep adjacent inline elements together Formatter: Fix ERB text flow formatting to keep adjacent inline elements together Feb 13, 2026
<strong>Bold Heading:</strong><br>
<%= Date.current %>: Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<strong>Bold Heading:</strong><br> <%= Date.current %>: Lorem ipsum
Copy link
Owner

Choose a reason for hiding this comment

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

The idea was that a <br> tag would also break the line in the text flow. I feel like it would be great if we could keep that behavior here.

Comment on lines +558 to +560
expect(result).not.toContain(`<%= foo %>\n sed`)
expect(result).not.toContain(`<%= bar %>\n .`)
expect(result).toContain(`<%= bar %>. Lorem`)
Copy link
Owner

Choose a reason for hiding this comment

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

Can we assert the full result here using toBe?

const source = `<p><strong>Summary:</strong><br> Lorem ipsum <%= foo %> dolor <%= bar %>. Sit amet...</p>`
const result = formatter.format(source)

expect(result).not.toContain(`<%= bar %>\n.`)
Copy link
Owner

Choose a reason for hiding this comment

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

Can we assert the full result here using toBe?

Comment on lines +515 to +516
expect(result).not.toContain(`<%= foo %>\n`)
expect(result).not.toContain(`<%= bar %>\n .`)
Copy link
Owner

Choose a reason for hiding this comment

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

Can we assert the full result here using toBe?

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.

Formatter: Newline added before . that follows ERB tag plus other issues, perhaps related to <br> tag

3 participants