Repository navigation
Closed
Labels
Description
Describe the bug
Indentation of the partial invocation site is not maintained when the partial is expanded.
From the README:
string source =
@"<h2>Names</h2>
{{#names}}
{{> user}}
{{/names}}";
string partialSource =
@"<strong>{{name}}</strong>";
Handlebars.RegisterTemplate("user", partialSource);
var template = Handlebars.Compile(source);
var data = new {
names = new [] {
new {
name = "Karen"
},
new {
name = "Jon"
}
}
};
var result = template(data);
/* Would render:
<h2>Names</h2>
<strong>Karen</strong>
<strong>Jon</strong>
*/Actual result:
<h2>Names</h2>
<strong>Karen</strong><strong>Jon</strong>
Here is a Fiddle to demonstrate:
https://dotnetfiddle.net/uB3Hmu
Expected behavior:
I expect the indentation of the partial invocation site to be respected when the partial is expanded. This would match other Handlebars implementations I've used, including the "official" npm package handlebars.
You can see the expected output on the Handlebars playground:
Screenshot:
Test to reproduce
https://dotnetfiddle.net/uB3Hmu
Activity
chandlerkent commentedon Jun 11, 2026
I would be happy to work on a Pull Request to resolve this if this would be of interest to the project.
Thanks for taking a look!
rexm commentedon Jun 11, 2026
Go for it
fix: preserve partial indentation (issue #614)
fix: preserve partial indentation (issue #614)
Merge pull request #635 from Handlebars-Net/worktree-agent-a2d376b707…
chandlerkent commentedon Jun 23, 2026
@rexm thanks for getting to this!
When do you expect to publish a new version?
rexm commentedon Jun 23, 2026
Probably Thursday