Today you can use <#nt> . The whitespace documentation reports the following about it:
Removing space can be disabled for a single line with the nt directive (for No Trim).
According to V2.3 changelog in previous versions, lines containing only FTL tags are truncated, with the exception of <#include> and user directives (for example, <@macroname> ). But in V2.3, they changed this behavior to ALWAYS cut off such lines. So, when using a macro, you can put <#nt> in a line to prevent cropping, and thus keep the indentation.
<#macro test> ...<#t> </#macro> Example: - <@test /><#nt>
gives the result:
Example: - ...
You can see that in the macro I defined <#t> , this is because the new line from the inside of the macro will not be trimmed and will always give a new line, where you are <@macro> , so in one part, we crop the white space, and in another part we save it!
Edit:
It should be noted that for some reason this only works for one line . If your macro has multiple lines, it only saves the indent for the first line. So far I have not found any fixes for this, but I created a problem in Freemarker JIRA for this.
Example:
<#macro test> ... wow </#macro> Example: - <@test><#nt>
will result in:
Example: - ... wow
Limnic
source share