TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.98k stars 1.18k forks source link

Exporting a readonly version of a node.js wiki #4298

Open scottsweb opened 4 years ago

scottsweb commented 4 years ago

Hoping someone can help poing me in the right direction, I am using the node.js version of tiddlywiki and exporting a single file version that I wish to upload with the following command:

tiddlywiki ./mywiki --rendertiddler "$:/plugins/tiddlywiki/tiddlyweb/save/offline" index.html text/plain "" publishFilter "-[tag[private]] -[has[draft.of]]"

The tiddlyweb plugin appears to have support for a readonly mode that I would like to set during export only. Is there a neat way to do this? Alternatively, perhaps I can inject custom CSS or change the theme when running an export only?

sycom commented 4 years ago

Maybe using setfield command on the text field of $:/status/IsReadOnly to set it to yes before running the renderTiddler command? Just an idea. I don't know if it works...

scottsweb commented 4 years ago

I think I may have a solution, I created a new $:/export system internal based on $:/plugins/tiddlywiki/tiddlyweb/save/offline. This references a new $:/export.html file (based on $:/core/templates/tiddlywiki5.html) which contains some custom CSS to hide the UI elements I want to remove.

I can then save the wiki with:

tiddlywiki ./mywiki --rendertiddler "$:/export" index.html text/plain "" publishFilter "-[tag[private]] -[has[draft.of]]"

I will also see if I can get your idea to work @sycom. Thanks for the suggestion.

linonetwo commented 1 year ago

Is this possible? I want to use lazy-all with readonly in a nodejs wiki, to create a server mode for TidGi.

AFAIK $:/status wont sync to client from nodejs server.

linonetwo commented 1 year ago

This works https://wiki.zhiheng.io/static/TiddlyWiki%253A%2520Readonly%2520for%2520Node.js%2520Server.html

Maybe you can close the issue