We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8841a5f commit 45443b4Copy full SHA for 45443b4
1 file changed
lib/handlebars/runtime.js
@@ -89,8 +89,15 @@ export function template(templateSpec, env) {
89
}
90
if (result != null) {
91
if (options.indent) {
92
- result =
93
- options.indent + result.replace(/\n(?!$)/g, '\n' + options.indent);
+ let lines = result.split('\n');
+ for (let i = 0, l = lines.length; i < l; i++) {
94
+ if (!lines[i] && i + 1 === l) {
95
+ break;
96
+ }
97
+
98
+ lines[i] = options.indent + lines[i];
99
100
+ result = lines.join('\n');
101
102
return result;
103
} else {
0 commit comments