I did see and create a guide with ChatGPT ChatGPT - TiddlyWiki Guide “Requires ChatGPT Plus” but not tested it too much, and I am sure more material can be added.
- I think going via PDF may be unnecessary.
An example Question and answer to my guide;
How do I code a filter operator in javascript?
Creating a custom filter operator in TiddlyWiki using JavaScript involves several steps, but it’s a great way to extend TiddlyWiki’s functionality to meet your specific needs. Here’s a basic guide to get you started:
1. Understand Filter Operator Structure
A filter operator in TiddlyWiki processes an input list of tiddler titles and outputs a modified list according to specific criteria. It typically has this structure:
-
Name: The operator’s identifier in filter expressions.
-
Function: The JavaScript function that implements the operator’s logic.
-
Parameters: Arguments that can modify the operator’s behavior.
2. Create Your JavaScript Module
You’ll need to create a JavaScript module that TiddlyWiki can recognize and load. This involves writing your filter operator’s code and saving it in a .js
file within your TiddlyWiki plugins folder, or embedding it directly in a tiddler set to the correct module type.
Here’s an example of a simple filter operator that filters tiddlers based on whether their titles are of even length:
/*\
title: $:/plugins/yourname/yourplugin/filters/evenlength.js
type: application/javascript
module-type: filteroperator
Filter operator to select tiddlers with titles of even length.
\*/
exports.evenlength = function(source, operator, options) {
var results = [];
source(function(tiddler, title) {
if(title.length % 2 === 0) {
results.push(title);
}
});
return results;
};
3. Module Type and Path
- Set the module type to
filteroperator
in your tiddler’s fields or your .js
file’s metadata.
- Choose a meaningful title/path. For plugins, a common convention is
$:/plugins/[yourname]/[pluginname]/filters/[operatorname]
.
4. Using Your Filter Operator
After adding the custom filter operator to your TiddlyWiki, you can use it like any built-in operator. For instance, assuming your operator is named evenlength
, you could use it in a filter like this:
[all[tiddlers]evenlength[]]
This filter would return all tiddlers with titles of even length.
5. Testing and Debugging
-
Test your filter operator thoroughly to ensure it behaves as expected.
- Use the browser’s developer tools to debug if something doesn’t work. Look for errors in the console, and check if your operator is being loaded correctly.
6. Documentation and Sharing
- Document how to use your filter operator, including examples.
- If you plan to share your plugin, consider publishing it on the TiddlyWiki community platforms or repositories.
Further Learning
For more complex behaviors, delve into TiddlyWiki’s core code to understand how built-in filter operators work. The TiddlyWiki documentation and source code are excellent resources for learning more about filter operators and TiddlyWiki’s internals.
Remember, creating custom functionality in TiddlyWiki can be incredibly rewarding. Don’t hesitate to experiment and explore the possibilities!