The static (literal) parts of the template string.
The dynamic parts of the template string, which will be injected into the corresponding placeholders in staticParts
.
A formatted string with fixed indentation and Unix-style line breaks (\n
), without carriage return characters (\r
).
Formats a multi-line template literal by adjusting indentation and preserving line breaks.
This function ensures consistent formatting of multi-line strings, which is particularly useful for defining code blocks or text outputs. It uses Unix-style newlines (
\n
), making it system independent.The indentation of dynamically inserted placeholders (
${...}
) will be adjusted to match the indentation level of the placeholder itself. This feature is especially useful for code generation scenarios, where nested structures or varying indentation levels are needed.Example