This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

Macro Calls in WikiText

21st February 2015 at 10:13pm
WikiText

To call a macro, place <<double angle brackets>> around the name and any parameter values.

By default, parameters are listed in the same order as in the macro's definition. A parameter can be labelled with its name, either for clarity or to modify the order.

If no value is specified for a parameter, the default value given for that parameter in the macro's definition is used instead. (If no default value was defined, the parameter is simply blank.)

Each parameter value can be enclosed in 'single quotes', "double quotes", """triple double quotes""" or [[double square brackets]]. Triple double quotes allow a value to contain almost anything. If a value contains no spaces or single or double quotes, it requires no delimiters.

A more formal presentation of this syntax is also available.

The syntax is actually a shorthand for a $macrocall widget. The widget itself offers greater flexibility, including the ability to transclude parameter values or generate them via additional macros.

As macros are simply parameterised variables, a variable's value can be inserted using the same techniques.

Examples

Named vs.unnamed parameters

In the wikitext notation, using named parameters is always the safer choice compared to defining values only. Not naming parameters may have confusing side effects. For example, imagine the first parameter of some macro specifies a state tiddler while the second one is intended for a template tiddler. Should you accidentally forget to define the first parameter or are confused about the order, the next time your macro is run, which might even be triggered using the preview, your template tiddler may inadvertently be overriden with what was intended to be the state.