A macro is a named snippet of text. WikiText can use the name as a shorthand way of transcluding the snippet. Such transclusions are known as macro calls, and each call can supply a different set of parameters that get substituted for special placeholders within the snippet.
For the syntax, see Macros in WikiText.
Most macros are in fact just parameterised variables.
The snippet and its incoming parameter values are treated as simple strings of characters with no WikiText meaning, at least until the placeholders have been filled in and the macro call has returned. This means that a macro can assemble and return the complete syntax of a WikiText component, such as a link. (See Transclusion and Substitution for further discussion of this.)
The string returned by a macro call is parsed separately from any surrounding WikiText components. So a safe way to insert a special character sequence (such as
<) without triggering its normal WikiText meaning is to wrap it in a macro.
Within a snippet itself, the only markup detected is
$name$ (a placeholder for a macro parameter) and
$(name)$ (a placeholder for a variable).
dumpvariables macro lists all variables (including macros) that are available at that position in the widget tree.
$importvariables widget can be used to copy macro definitions to another branch of the widget tree. TiddlyWiki uses this technique internally to implement global macros – namely any macros defined in tiddlers with the
$:/tags/Macro tag. (The tag
$:/tags/Macro/View is used to define macros that should only be available within the main view template and the preview panel).
TiddlyWiki's core has several macros built in.