Conversation
ed1ea4f to
80bd811
Compare
80bd811 to
6c79f92
Compare
23b80f9 to
88cd90b
Compare
88cd90b to
ade5af9
Compare
commit: |
🌿 Interactive Playground and Documentation PreviewA preview deployment has been built for this pull request. Try out the changes live in the interactive playground: 🌱 Grown from commit ✅ Preview deployment has been cleaned up. |
marcoroth
added a commit
that referenced
this pull request
Mar 16, 2026
This pull request adds support for detecting ActionView `render` calls
in ERB templates and representing them as structured `ERBRenderNode`
nodes.
A new `render_nodes` parser option is available to enable this analysis
(defaults to `false`, since `render` may mean something different
outside of Rails).
When enabled, `ERBContentNodes` containing a render call are transformed
into `ERBRenderNodes` with extracted fields that mirror ActionView's
render keyword arguments.
For example, the following template:
```erb
<%= render partial: "card", locals: { title: @title, body: "Hello" } %>
```
Produces the following with `render_nodes: true`:
```js
@ DocumentNode (location: (1:0)-(1:71))
└── children: (1 item)
└── @ ERBRenderNode (location: (1:0)-(1:71))
├── tag_opening: "<%=" (location: (1:0)-(1:3))
├── content: " render partial: "card", locals: { title: @title, body: "Hello" } " (location: (1:3)-(1:69))
├── tag_closing: "%>" (location: (1:69)-(1:71))
├── partial: "card" (location: (1:20)-(1:26))
├── template_path: ∅
├── layout: ∅
├── file: ∅
├── inline_template: ∅
├── body: ∅
├── plain: ∅
├── html: ∅
├── renderable: ∅
├── collection: ∅
├── object: ∅
├── as: ∅
├── spacer_template: ∅
├── formats: ∅
├── variants: ∅
├── handlers: ∅
├── content_type: ∅
└── locals: (2 items)
├── @ RubyRenderLocalNode (location: (1:38)-(1:51))
│ ├── name: "title" (location: (1:38)-(1:44))
│ └── value:
│ └── @ RubyLiteralNode (location: (1:45)-(1:51))
│ └── content: "@title"
│
└── @ RubyRenderLocalNode (location: (1:53)-(1:66))
├── name: "body" (location: (1:53)-(1:58))
└── value:
└── @ RubyLiteralNode (location: (1:59)-(1:66))
└── content: "\"Hello\""
```
Resolves #1373
Enables #160
Enables #181
Enables #182
Enables #639
Enables #654
Enables #1386
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for detecting ActionView
rendercalls in ERB templates and representing them as structuredERBRenderNodenodes.A new
render_nodesparser option is available to enable this analysis (defaults tofalse, sincerendermay mean something different outside of Rails).When enabled,
ERBContentNodescontaining a render call are transformed intoERBRenderNodeswith extracted fields that mirror ActionView's render keyword arguments.For example, the following template:
Produces the following with
render_nodes: true:Resolves #1373
Enables #160
Enables #181
Enables #182
Enables #639
Enables #654
Enables #1386