Skip to content

Conversation

@marcoroth
Copy link
Owner

This pull request fixes an issue where ERB output tags ending with inline Ruby comments caused syntax errors when being compiled.

For example, this template:

<%= link_to "Root", root_path # this is the href %>

Previously compiled to:

_buf << (link_to "Root", root_path # this is the href).to_s;

The # starts a comment and will comment out ).to_s; which leads to runtime syntax errors. The fix adds a newline before closing parentheses when the code contains #:

_buf << (link_to "Root", root_path # this is the href
).to_s;

In the future, we could ideally omit/strip code comments altogether using Prism.

Fixes #964

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 18, 2026

npx https://pkg.pr.new/@herb-tools/formatter@1083
npx https://pkg.pr.new/@herb-tools/language-server@1083
npx https://pkg.pr.new/@herb-tools/linter@1083

commit: 75a836b

@github-actions
Copy link

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit 75a836b

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

2 participants