Note: An alternative skin, TW4MW (work in progress), is available from the user preferences.

Macros

TiddlyWiki Community Wiki

Jump to: navigation, search
This page is still incomplete. You can help by contributing to its expansion.
Please improve the article, or discuss the issue on the talk page.

Macros provide commands to perform a variety of advanced functions in the place they are called at.

A macro is usually called by adding something like the following to a specific tiddler:

<<macroName [parameters]>>

In contrast to plugins, a macro's code is only executed when the respective tiddler containing the macro call is rendered.

Contents

[edit] Parameters

Generally, there are four ways to use macro parameters:

  • no enclosing: <<foo bar baz>>
  • single quotes: <<foo 'bar' 'baz'>>
  • double quotes: <<foo "bar" "baz">>
  • double brackets: <<foo [[bar]] [[baz]]>>

Empty parameters (e.g. to adopt default value if the parameter is optional) are inserted by enclosing an empty string (, "" or [[]]).

There's also fifth way, using curly brackets ({{...}}) - those contents are evaluated, so they're only used if the parameter value has to be calculated in some way.

[edit] Named Parameters

This section is still incomplete. You can help by contributing to its expansion.
Please improve the article, or discuss the issue on the talk page.
<<macro label:value>>

[edit] Evaluated Parameters

Parameters enclosed in {{ ... }} are processed as JavaScript code.

[edit] See Also

Personal tools