How to "Remove a leading blank line"

This will be moved to How To once resolved.

When using a macro and passing multiline content in a parameter;

<<mymacro '
Block of text
Over more than one line
'>>

The above is easier to read but there is a newline after the first ', and before the last ' but I am not concerned with the last.

I am wondering if any one has a simple method to remove the first “line” (possibly if blank) from the parameter in the macro, whist keeping the rest in its current block format?

Thanks in advance.

https://tiddlywiki.com/#trim%20Operator

@saqimtiaz good lead, I will try it shortly. In a particular case I also found this;

\define amacro(content)
{{{ [[$content$]splitregexp[\n]] }}}
\end

<<amacro '
one
two
'>>

because empty lines will be nul and not in the output.

Nice catch, … but I think the trim[] functions would be a bit more performant. …

I wanted to write, that tirm[] uses the javascript builtin .trim() functions, just to find out, that we use some older code … which we should probably change. I’ll create an issue at GH

2 Likes