
* Save binary tiddlers with meta file The filesystemadaptor plugin was a little simplistic in its understanding of a binary file. It was using the typeInfo dictionary to choose what tiddler types were binary (and hence needed a meta file when saving). I looked as if it was trying to be smart by looking for the hasMetaFile *OR* had the encoding of base64. Unfortunately the typeInfo only defined image/jpeg and so any other base64 encoded tiddler was assumed to be of type text/vnd.tiddlywiki. The net effect was only JPG images got a meta file and everything else were saved as .tid files with base64 encoding. It all still worked but made working with binary data in a Git repo a bit daunting. There is enough information in the $tw.config.contentTypeInfo to determine if a tiddler type is encoded with base64 or not. A better list is available from boot/boot.js who registers all the types thorough the registerFileType and marks then with base64 were appropriate. This commit uses the typeInfo dictionary first for any filesystem specific overrides, then the contentTypeInfo, and finally defaults to the typeInfo["text/vnd.tiddlywiki"]. It also eliminates the now unnecessary override for image/jpeg. I think this might have been the original intent from commit 10b192e7. From my limited testing all files described in boot/boot.js (lines 1832-1856) with an encoding of base64 now save as the original binary and a meta file. Meaning that when you start the node server and then drag-n-drop a binary file (i.e. image/png) it will PUT to the server and then save it on the filesystem as-is allowing the file to be managed as a binary file and not a text file. (Binary diffs are better and GitHub supports them as well). * Prevent duplicate file extensions A side effects of using the $tw.config.contentFileInfo in the previous commit is that it will always append a file extension to the tiddler title when saving. In most cases this is the correct course of action. However, sometimes that title is already a proper filename with an extension (for example importing 'foobar.png' would save a file named 'foobar.png.png') which seemed silly. This commit simply checks to make sure the title does not already end with the file extension before appending it to the filename. A little convenience really. Since IE apparently doesn't have the String endsWith method I took the liberty to add a helper method to $tw.utils trying to follow the other polyfill patterns. I figured this was more generic and readable then attempting to use a one-off solution inline. I got the polyfill code from MDN. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith#Polyfill Is strEndsWith the best method name?
Welcome to TiddlyWiki, a non-linear personal web notebook that anyone can use and keep forever, independently of any corporation.
TiddlyWiki is a complete interactive wiki in JavaScript. It can be used as a single HTML file in the browser or as a powerful Node.js application. It is highly customisable: the entire user interface is itself implemented in hackable WikiText.
Learn more and see it in action at http://tiddlywiki.com/
Developer documentation is in progress at http://tiddlywiki.com/dev/
Installing TiddlyWiki on Node.js
- Install Node.js from http://nodejs.org
- Open a command line terminal and type:
npm install -g tiddlywiki
If it fails with an error you may need to re-run the command as an administrator:
sudo npm install -g tiddlywiki
(Mac/Linux) - Check TiddlyWiki is installed by typing:
tiddlywiki --version
- In response, you should see TiddlyWiki report its current version (eg "5.1.10"; you may also see other debugging information reported)
- Try it out:
tiddlywiki mynewwiki --init server
to create a folder for a new wiki that includes server-related componentstiddlywiki mynewwiki --server
to start TiddlyWiki- Visit http://127.0.0.1:8080/ in your browser
- Try editing and creating tiddlers
The -g
flag causes TiddlyWiki to be installed globally. Without it, TiddlyWiki will only be available in the directory where you installed it.
If you are using Debian or Debian-based Linux and you are reciving a node: command not found
error though node.js package is installed, you may need to create a symbolic link between nodejs
and node
. Consult your distro's manual and whereis
to correctly create a link. See github issue 1434
Example Debian v8.0: sudo ln -s /usr/bin/nodejs /usr/bin/node
Using TiddlyWiki on Node.js
TiddlyWiki5 can be used on the command line to perform an extensive set of operations based on TiddlyWikiFolders, TiddlerFiles and TiddlyWikiFiles.
For example, the following command loads the tiddlers from a TiddlyWiki HTML file and then saves one of them in static HTML:
tiddlywiki --verbose --load mywiki.html --rendertiddler ReadMe ./readme.html
Running tiddlywiki
from the command line boots the TiddlyWiki kernel, loads the core plugins and establishes an empty wiki store. It then sequentially processes the command line arguments from left to right. The arguments are separated with spaces.
The first argument is the optional path to the TiddlyWikiFolder to be loaded. If not present, then the current directory is used.
The commands and their individual arguments follow, each command being identified by the prefix --
.
tiddlywiki [<wikipath>] [--<command> [<arg>[,<arg>]]]
The available commands are:
- build
- clearpassword
- editions
- help
- init
- load
- makelibrary
- output
- password
- rendertiddler
- rendertiddlers
- savetiddler
- savetiddlers
- server
- setfield
- unpackplugin
- verbose
- version
Upgrading TiddlyWiki on Node.js
If you've installed TiddlyWiki on Node.js on the usual way, when a new version is released you can upgrade it with this command:
npm update -g tiddlywiki
On Mac or Linux you'll need to add sudo like this:
sudo npm update -g tiddlywiki
Also see
-
TiddlyWikiFolders
-
MultiTiddlerFileSyntax
-
MultiTiddlerFiles
-
TiddlerFiles
-
Generating Static Sites with TiddlyWiki
-
How to build a TiddlyWiki5 from individual tiddlers
-
Using TiddlyWiki for GitHub project documentation
-
Using a custom path prefix with the client-server edition
-
Building TiddlyWikiClassic
-
Environment Variables on Node.js
-
Scripts for TiddlyWiki on Node.js
-
Working with the TiddlyWiki5 repository
This readme file was automatically generated by TiddlyWiki