How to run a macro when a button is clicked?

What is the syntax to run a macro when a button is clicked?

What have I tried?

I tried this syntax

   <$macrocall $name="jsontiddlers" filter="[[Test]get[text]]" $output="text/raw"/>

The output is


Not sure where the extra [] comes from.

What am I trying to do?

I want to have a custom button to export my selected tiddlers in JSON format.

Try this:

<$button> export
   filename="tiddlers.json" />

Where the value for exportFilter is a filter syntax that supplies the titles of the desired tiddlers.


Thank you so much. I misread the official documentation and thought this macro is used for exporting the tiddlers into JSON. My bad.

Posting my final solution here, which someone might find useful.

<$button> export
<$set name="filter" filter="[[Test]get[text]]">

   filename="tiddlers.json" />



If you create a tiddler Test and fill it with some filters. Like


Then clicking on the button, which is given above, will export the tiddlers that match the filters in JSON format.

Why? (Use case)

I am exploring different ideas to easily sync my configuration across all my TWs.

One solution I have in mind goes like this

  1. Create a master copy of TW
  2. Configure it to your liking
  3. Collect the list of system and shadown tiddlers you configured in a tiddler, like Config-List, using filters
  4. Export all the tiddlers in JSON using the button given above and import into new TWs

Using explicit filters in Config-List means I will not export frivolous shadow tiddlers.