An Idea: Make a Hexo Analogy in TWC World

78 views
Skip to first unread message

sam paul

unread,
Jun 26, 2025, 11:48:08 PMJun 26
to TiddlyWikiClassic
Hello. I see the tiddlywiki classic is built up by smaller .tid file by scripts in the folder https://github.com/TiddlyWiki/TiddlyWikiClassic/tree/master/build. I think it is a good idea to make a CLI app as an analogy to hexo. Users write .tid file instead of markdown and run <tiddlywiki_cli> build_site to generate the html file.

Best,
Sam

Yakov

unread,
Jul 11, 2025, 6:36:24 PMJul 11
to TiddlyWikiClassic
That's quite possible with the current building tools, a TWC can be build with TW5 like the main site is: see the build-site command in package.json. The build_site.js script does some additional stuff (like generating RSS which in most case one won't need), but you can reuse the main build-from-files thing. What's not exactly convenient is that you have, aside creating .tid files, list them inside the .recipe file (like split.recipe used in index.html.recipe in the case of the main site), although it gives some flexibility (i.e. if some file is outdated, you can exclude it from the recipe to temporarily skip it in the resulting TW).

I'm not familiar with Hexo, so let me know if something is missing for a similar solution; you may also share what would you use it for so it's clearer what are you expecting from such a tool.

пятница, 27 июня 2025 г. в 06:48:08 UTC+3, samp...@gmail.com:

sam paul

unread,
Jul 17, 2025, 11:18:39 PMJul 17
to TiddlyWikiClassic
Dear Yakov,

For example, it would be nice if there were CLI tools to add or remove tiddlers, and change tiddler content.

Best,

Sam

Yakov

unread,
Jul 18, 2025, 3:41:01 PMJul 18
to TiddlyWikiClassic
Right, I think there's no CLI tools or libs to edit an existing TWC, except my cli script to upgrade core of a TWC, which may be helpful to implement what you have described.

I'm not sure what TW5 is capable of in terms of editing, though. And also there's an old ruby script for "slicing" a TW called ginsu.

To implement what you are describing, it would be best to find some html parser, read TW like my cli script does, parse the tiddlers and also parse .tid files, and then do things with the .tid files and the content to insert or edit. I.e. presumably it's best to implement "serializers", "deserializers" and some kind of internal model for editing.

It would be also good to build a cli that builds TWC without TW5 (from the recipes and .tid files), because in that case we could update the outdated core building flow (for example, if the js files import each other and we can build the core by throwing away the imports, we could use Jest/Vitest for tests instead of using outdated tools). But honestly, these things are too far in the "nice to have" area for me, and I don't think I'll take care of them soon.

If you want to implement something in this area, I'll be glad to help, though.

пятница, 18 июля 2025 г. в 06:18:39 UTC+3, samp...@gmail.com:

sam paul

unread,
Jul 26, 2025, 1:40:23 PMJul 26
to TiddlyWikiClassic
Dear Yakov,

I tried ginsu. But it doesn't work for some reason.

ruby ginsu.rb blog.html --quiet
ginsu.rb:101:in `<main>': undefined method `quiet=' for Splitter:Module (NoMethodError)

Splitter.quiet = options.quiet
        ^^^^^^^^

How do you split TiddlyWiki Classic's main site into recipes and tid?

Best,

Sam

Yakov

unread,
Aug 14, 2025, 3:46:01 AMAug 14
to TiddlyWikiClassic
Hi Sam,

>  How do you split TiddlyWiki Classic's main site into recipes and tid?

That's not the case, the current flow is unidirectional: recipes and .tid are "the source of truth" and index.html is built out of them. I don't "split" the site (and generating recipes doesn't sound possible at all, because it's not algorithmic, it's just a convention).

However, I agree that generating .tid files from html would be useful even with fixed recipes (since editing the TW is more convenient, so splitting would help when working on docs). I took some time and created a beta splitter that you can find in TwUpgradeCli in the splitting branch. Current usage is

node split.js --input "path/to/TiddlyWiki.html" --output "path/to/output_dir"

I've tested it on the core content (i.e. .tid → build → split gives .tid files almost identical, just the date format is more standardized), so it is somewhat production-ready. Ideally, TWC core should become more reusable and various methods of it should be reused (tw-parser reproduces various core methods, not very accurately yet though), but that requires also changing the building change of TW core, so I'm not sure if I deal with it any time soon. Though, I've used help of Windsurf for splitting which accelerated development considerably, so maybe I'll give it a try for the core as well, we'll see.

Let me know if it works for you and what you think overall.

Best regards,
Yakov

суббота, 26 июля 2025 г. в 20:40:23 UTC+3, samp...@gmail.com:

sam paul

unread,
Aug 14, 2025, 5:38:06 AMAug 14
to TiddlyWikiClassic
Dear Yakov,

That is great. I made a wasm wrapper of the old cooker along with ruby 1.8, using https://github.com/container2wasm/container2wasm. The usage and docker file is here https://github.com/wangyenshu/cooker_wasm . You can download cooker.wasm from the release file. This could simplify the process to split old wikis before your split.js becomes stable. The demo usage requires https://wasmtime.dev/ .

Best,
Sam

sam paul

unread,
Aug 31, 2025, 1:51:34 AMAug 31
to TiddlyWikiClassic
Dear Yakov,

Your beta splitter works for my wiki. I have a small suggestion. It would be better if the splitter could classify the split file into content, themes, shadows, and plugins, just like the original cooker.

Best,
Sam

Yakov

unread,
Sep 5, 2025, 1:16:03 PM (9 days ago) Sep 5
to TiddlyWikiClassic
Dear Sam, like I mentioned earlier, generating other parts of the recipe (i.e. the main recipe and the template parts) can't be automated as those can be somewhat arbitrary (note, for instance, that html/split.recipe uses parts splitted further, and  tiddlywiki.template.html  has various placeholders that are filled on building, while this could be, for instance, one-level recipe, with no intermediate pieces, I guess). Think, for instance on how should we distinguish a standard recipe(s), the externaljs recipes and some custom ones – this seems impossible to me (but maybe I don't account some restrictions of the TW5 as a builder script). We can hardcode the splitter to generate the main recipe and its sub-recipes, but does it need efforts if those can be copy-pasted from the TWC repo?

On the other hand, there's one bit that can be generated, and should be – that is the split.recipe that list the tiddlers themselves. I've added this feature (for now, kept the sorting like in the original repository, although that's unnecessary complication, and I'll amend it in the future with the core split.recipe), see the repo (same branch).

воскресенье, 31 августа 2025 г. в 08:51:34 UTC+3, samp...@gmail.com:
Reply all
Reply to author
Forward
0 new messages