Hello
I have stand alone tiddlywikis files, not using node js or server
is there a way to export to json file from command line in linux?
thank you
Hello
I have stand alone tiddlywikis files, not using node js or server
is there a way to export to json file from command line in linux?
thank you
Node.js is most commonly used with tiddlywiki to run the server using the –listen command line option. However, there are many other command line options. For your use case, the load command can be used to load a standalone wiki and the render command can be used to select tiddlers to render to a json file. Like this:
node tiddlywiki.js --load 'my-standalone-wiki.html' --render "." tiddlers.json \
text/plain '$:/core/templates/exporters/JsonFile' 'exportFilter' '[tag[sometag]]'
Replace tiddlers.json
with whatever filename you want to save the output to.
Replace [tag[sometag]]
with whatever filter selects the tiddlers you want in the output json.
See https://tiddlywiki.com/#Installing%20TiddlyWiki%20on%20Node.js for more on installing node.js
Thank you btheado
Finally I use this command line:
tiddlywiki --load my-standalone-wiki.html --output where/youwant --render '.' tiddlers.json text/plain '$:/core/templates/exporters/JsonFile' 'exportFilter' '[!is[system]]''
I had to install nodejs and npm (>150Mb) to accomplish this but I see it’s the only way
We had a similar need and I didn’t want to go the NodeJS maximalist route. So I create a short script, written in Nim that allowed us to extract the JSON tiddlers storage part inside the HTML file. It has worked well for our purposes, while it could be improved for more generality and robustness (as you can see, I fixed the wiki’s html file name, following our internal conventions and common practices regarding such name, but this could be a script’s paramenter).
The script requires Nim, of course, but its installer is 10 times smaller than NodeJS and self contained binaries for multiple OS can be packaged to remove Nim’s requirement.
I share your concern. It is kind of bittersweet that the minimalism of TiddlyWiki on the client, with just a single HTML file and no huge/popular JS framework behind, is kind of defeated on the server, by the huge and overcomplicated requirement of NodeJS. Still there is a lot of functionality that is offered only there and that’s why I’m exploring the server counterpart with Bun which seems to have a cleaner design, been quicker and more integrated. So far my explorations regarding format conversions have been satisfactory.
If you want node.js only for the above task. You can download a portable version around 15-20Mb for example from here: Release NodeJS Portable v6.14.2 · garethflowers/nodejs-portable
tiddlywiki --load my-standalone-wiki.html --output ‘where/youwant --render ‘.’ tiddlers.json text/plain ‘$:/core/templates/exporters/JsonFile’ ‘exportFilter’ ‘[!is[system]]’’
I think the correct script is (note to the quotes)
tiddlywiki --load my-standalone-wiki.html --output ‘where/youwant’ --render ‘.’ tiddlers.json text/plain ‘$:/core/templates/exporters/JsonFile’ ‘exportFilter’ ‘[!is[system]]’