A big phone project at work has motivated me to finally do something I’ve wanted to do for a long time: create a customer phonenumber
format I can apply to unformatted number strings. The idea is to take phone numbers stored in tiddler fields in the format 1234567890
and display them as (123) 456-7890
.
To do this, I searched up the TWcore’s dateformat module, poked and prodded, consulted the usual sites, trialed-and-errored, and eventually quizzed Microsoft Copilot on why my plugin-to-be isn’t working.
Copilot seems to think the problem is that my formatters aren’t being registered by TiddlyWiki under Node.js — how I normally use TW — and that, to get the formatter modules to register, I should install a copy of the tiddlywiki/core
plugin in my wiki folder.
I could be wrong, but that doesn’t seem like the root of my problem. I don’t think I should have to update a local copy of the core plugin every time I update TiddlyWiki globally under Node.
Normally, updating under Node updates all my core plugins. I call those native/core plugins explicitly from the global store in the tiddlywiki.info
file for each new wiki I create. But the core itself doesn’t exist in the npm\node_modules\tiddlywiki\plugins
folder, so I don’t explicitly include it in my plugin calls in tiddlywiki.info
files. Maybe I could/should do that — but I’m not convinced, at least not by an AI assistant.
Plus, I want my custom formatters to work in single-file HTML wikis, too — and when I export what I currently have to a single-file wiki, it still doesn’t work. Which means that if the problem is the formatters not being registered, they aren’t going to get registered when I load a single-file wiki, either — regardless of my Node setup back on my desktop.
Does anyone have any insights?
Or any good custom formatters of their own I could cheat off of?
You can see what I’ve cobbled together so far here, if you’d like to take a look: (All the constituent tiddlers can be accessed in the Tiddlers list in the sidebar.)
https://tiddlywiki.secret-hq.com/plugins/telephone-numbers