You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Raw block helpers fail to compile when Compatibility.RelaxedHelperNaming is enabled #676
The closing raw tag is mistaken for the start of a block helper.
HelperConverter.IsUnregisteredBlockHelperName (source/Handlebars/Compiler/Lexer/Converter/HelperConverter.cs) checks the closing word /raw from {{{{/raw}}}}.
With the default setting, /raw fails the IsValidHelperLiteral check and is left as a plain word. With RelaxedHelperNaming on, that check is skipped.
Inside raw tags, the !isRaw && ... guard doesn't apply either. Unlike IsRegisteredHelperName and IsRegisteredBlockHelperName, this method never rejects pathInfo.IsBlockClose.
It strips the first character (/raw → raw), looks for /raw in the template, finds the very tag it is checking, and turns that closing tag into a HelperExpression.
RawHelperAccumulator.IsClosingTag only recognizes a WordExpressionToken with the value /raw. So the closing tag is never found and the accumulator reaches the end of the template.
A likely fix is to add if (pathInfo.IsBlockClose) return false; to IsUnregisteredBlockHelperName, as the other two checks already do. This needs a regression test that runs raw blocks with RelaxedHelperNaming both on and off.
Context
Found while working on #672. It exists on master and is unrelated to that change.
I'm the agent handling issue intake on Rex's behalf. I understand this as: with Compatibility.RelaxedHelperNaming = true, raw block helpers ({{{{raw}}}}...{{{{/raw}}}}) fail to compile because the closing tag is misread as a block helper opener. I'll evaluate whether I can fix this autonomously.
Fixed on branch claude/issue-676. It has not been merged or released.
Handlebars-Net/Handlebars.Net (the only repo changed)
HelperConverter.IsUnregisteredBlockHelperName now returns false for block-close paths (/name), the same way IsRegisteredHelperName and IsRegisteredBlockHelperName already do. Before this, with RelaxedHelperNaming = true, the {{{{/raw}}}} closing tag was turned into a block helper expression. RawHelperAccumulator then never found the closing tag, so compilation failed.
Behavior with the default setting is unchanged. A /name word only reached this check inside raw tags with relaxed naming turned on, which is exactly the case that was broken.
Verification
Added RawHelperTests.RawBlockHelperCompilesRegardlessOfRelaxedHelperNaming. It covers empty raw blocks, raw blocks with a mustache body, nested raw tags, and raw blocks with arguments, each with RelaxedHelperNaming both off and on. Before the fix the 4 relaxed cases failed and the 4 default cases passed.
After the fix the full test suite passes: 2193 passed, 0 failed.
Shipped: nothing. The work is staged on the branch for a maintainer to review and merge.
Handlebars-Net/Handlebars.Net (the only repo changed): I opened #677 from claude/issue-676 and requested auto-merge. GitHub will merge it into master once the required checks pass; it has not landed yet.
Change:HelperConverter.IsUnregisteredBlockHelperName now rejects block-close paths. This means {{{{/raw}}}} is no longer read as the start of a block helper when RelaxedHelperNaming is on. Behavior with the default setting is unchanged.
Verification: the new tests in RawHelperTests.RawBlockHelperCompilesRegardlessOfRelaxedHelperNaming cover raw blocks with the setting both off and on. Before the fix the 4 relaxed cases failed. After it the full suite passes (2193 passed, 0 failed).
No NuGet release has been cut. Publishing a new version is a separate maintainer step.
Activity
rexm commentedon Nov 7, 2026
/harness adopt
stencil-harness commentedon Nov 7, 2026
I'm the agent handling issue intake on Rex's behalf. I understand this as: with
Compatibility.RelaxedHelperNaming = true, raw block helpers ({{{{raw}}}}...{{{{/raw}}}}) fail to compile because the closing tag is misread as a block helper opener. I'll evaluate whether I can fix this autonomously.stencil-harness commentedon Nov 7, 2026
Fixed on branch
claude/issue-676. It has not been merged or released.Handlebars-Net/Handlebars.Net (the only repo changed)
HelperConverter.IsUnregisteredBlockHelperNamenow returnsfalsefor block-close paths (/name), the same wayIsRegisteredHelperNameandIsRegisteredBlockHelperNamealready do. Before this, withRelaxedHelperNaming = true, the{{{{/raw}}}}closing tag was turned into a block helper expression.RawHelperAccumulatorthen never found the closing tag, so compilation failed./nameword only reached this check inside raw tags with relaxed naming turned on, which is exactly the case that was broken.Verification
RawHelperTests.RawBlockHelperCompilesRegardlessOfRelaxedHelperNaming. It covers empty raw blocks, raw blocks with a mustache body, nested raw tags, and raw blocks with arguments, each withRelaxedHelperNamingboth off and on. Before the fix the 4 relaxed cases failed and the 4 default cases passed.Shipped: nothing. The work is staged on the branch for a maintainer to review and merge.
rexm commentedon Nov 7, 2026
/harness ship
stencil-harness commentedon Nov 7, 2026
I opened #677 to ship the fix.
Handlebars-Net/Handlebars.Net (the only repo changed): I opened #677 from
claude/issue-676and requested auto-merge. GitHub will merge it intomasteronce the required checks pass; it has not landed yet.HelperConverter.IsUnregisteredBlockHelperNamenow rejects block-close paths. This means{{{{/raw}}}}is no longer read as the start of a block helper whenRelaxedHelperNamingis on. Behavior with the default setting is unchanged.RawHelperTests.RawBlockHelperCompilesRegardlessOfRelaxedHelperNamingcover raw blocks with the setting both off and on. Before the fix the 4 relaxed cases failed. After it the full suite passes (2193 passed, 0 failed).No NuGet release has been cut. Publishing a new version is a separate maintainer step.
fix: don't treat raw block close tag as a block opener under RelaxedH…