The right way to install the shiraz plugin on NodeJS

I’ve looked at Problem installing shiraz plugin on node.js server but I still can’t understand how to install the Shiraz plugin under NodeJS. I’ve tried all kinds of names in the tiddlywiki.info file but nothing worked. Thanks for any suggestions.

I gave up and just drag and dropped it directly into each of my nodejs wikis.

2 Likes

Ah, found the instructions here: Shiraz 2.8.2 — create stylish contents in Tiddlywiki

image

If you’re comfortable with the command line, and have git and node installed, then this will create a new wiki, add the three shiraz plugins to it, and start it running:

*nix (maybe including Mac?)

$ mkdir 2023-05-09a
$ cd 2023-05-09a
$ mkdir MyWiki
$ tiddlywiki MyWiki --init server
$ git clone https://github.com/kookma/TW-Shiraz.git
$ cp -r ./TW-Shiraz/source/. ./MyWiki/plugins
$ tiddlywiki MyWiki --listen port=7890

Windows

> mkdir 2023-05-09a
> cd 2023-05-09a
> mkdir MyWiki
> tiddlywiki MyWiki --init server
> git clone https://github.com/kookma/TW-Shiraz.git
> xcopy TW-Shiraz\source MyWiki\plugins /i /e
> tiddlywiki MyWiki --listen port=7890

The only difference between the two is in the copy statement. The wiki should now be running at http://localhost:7890. And you should be able to see some subtle Shiraz formatting already (mostly non-default colors.)

For an existing wiki, if there is not a plugins folder in the root, create it. And then add the three folders found in the source folder of https://github.com/kookma/TW-Shiraz to this plugins folder. (If you’re not versed in git, under the CODE button on that page, should be an option to “Download zip”.) You will then need to restart the wiki.

2 Likes

Do you know how to use/install other plugins on Node.js? if yes, Shiraz installation is the same!

All kookma plugins shipped with both packaged and node.js version of plugin! A detailed description has been given in demo page!

It will be burdensome to upgrade it and check for upgrades.

So I recommend using Kookma Library — Plugins for Tiddlywiki5, or https://tw-cpl.netlify.app/ so you can upgrade in GUI.

Yes, and I don’t understand why the default for Node (https://tiddlywiki.com/#Installing%20custom%20plugins%20on%20Node.js) looks something like this. In practice, I simply drag the plugins to my Node-based wiki.

The documentation says,

  • This mechanism should only be used in a Node.js configuration for testing and debugging purposes, since the plugins are stored in the tiddlers/ directory

but I’ve never understood why that is a problem. If I’m developing the plug-in, sure, this makes sense: I want the individual files easily accessible. But if I’m simply using it, what does it hurt if it’s in the tiddlers folder as a single file (possibly plus a .meta file.)

Can someone explain this?

I started down that path but went with drag and drop based on the conversation below:

1 Like

I guess previously, only geek use nodejs wiki, because it requires user to access terminal command line shell, so adding plugin in a geek way is not a problem.

But now with TidGi app, even normal user can use TW nodejs wiki in an Obsidian-like way, so I think this rule will need to change when target user is TidGi app user.

(If you are using terminal to start nodejs wiki…You can keep the geek way)

It also seems resonable to me to suggest the reason to install plugins as files into node is to make it available to all wikis within it. This uses less disk but most peoples local storage is more than enought to not bother. My local node wikis tend to have different functions and often different plugins as do my single file wikis so I tend to only use drag and drop. The exception may be automated wiki generation and other server side manipulation.

  • it may make sense to install code mirror, internals and relink plugins as examples

I did create a HowTo video series about plugins in TW, using the TW docs tiddlers. I think it can answer most of the questions about TW and also 3rd party plugins

2 Likes

that’s super useful info

thank you!

$ mkdir 2023-05-09a
$ cd 2023-05-09a
$ mkdir MyWiki
$ tiddlywiki MyWiki --init server
$ git clone GitHub - kookma/TW-Shiraz: Shiraz is a small Tiddlywiki 5 plugin contains macros, stylesheets, templates, snippets, images, static tables, dynamic tables and acts as a starter kit.
$ cp -r ./TW-Shiraz/source/. ./MyWiki/plugins
$ tiddlywiki MyWiki --listen port=7890

All of the above is correct. I would only add that a symlink works as well – no need to copy the code.

Because of this shown in the docs.

Important:

  • Elements lower in the list take precedence

No matter what, the system will always use the drag&drop imported plugins. … That’s intended. But your environment variables and your plugin-folders will be ignored.

If you are a consumer only, that’s OK.

But as soon as you start to develop plugins, this can cause a very strange behaviour, if you change the plugin source, restart the server, but nothing happens. …

So there is no problem, until you wasted hours of searching in your node setup, your code, the TW core code … , just to find out, that drag & dropped plugins always win.

Ahh, that makes sense. I almost never modify the raw tiddler files, and when I do, I need to stop and think carefully anyway. But when I do plugin development in Node, I simply modify things in-wiki, and copy the resulting .tid files from the tiddlers folder over their plugin counterparts. It’s perhaps not the most efficient workflow, but it’s worked for me so far. I could easily imagine the problems if I’m building a complex plugin.

Thanks for the information!