This is a node.js-based wikifier for TiddlyWiki formatted wikitext.
By using jsdom and htmlparser with node, it is possible to simulate the browser environment that the wikifier would normally run in, and create some HTML output.
(The below is for OS X but should transliterate to other environments. It has also been tested on Ubuntu 12.04)
Install node.js and its package manager npm. If you are using brew that goes like this:
brew install node npm
Once you have npm, install grunt with:
npm install -g grunt-cli
Then install the project dependencies:
In the repo directory run:
This will get all the necessary TiddlyWiki code and concatenate it into
dist/twikifier.js. The grunt test task is run after this and runs all
the files in the
test/files directory against twikifier via
The task also creates a distributable node application in
Building For Different Installations
grunt by default will build twikifier for TiddlySpace.
To build for other installation types (e.g. tank) run the following:
This builds a customised version of twikifier that will wikify text according to the rules of the given installation.
To create a custom build, add function overrides to
naming the files after the installation. Then run:
From the test directory, you can try your own wikitext by piping data into twikify on STDIN:
node twikify.js --collection=<url for tiddler collection> \ < /tmp/mysampledata.txt
or by giving the names of multiple files on the command line:
node twikify.js --collection=<url for tiddler collection> \ /tmp/mysampledata.txt /tmp/someotherdata.txt
<url for tiddler collection> should be replaced with the url of a
collection of tiddlers, in JSON, as found in TiddlyWeb. Things like:
As the tool develops there will be other interfaces.
Testing the NPM Package Works
From the repo directory run:
This will create a zipped tarball. Install this tarball as follows:
npm install -g twikifier-x.y.z.tgz
If all is well,
twikifier will be available in your path. Run this to
check twikifier works.
Releasing the NPM Package
See this link for how this works.
Use with TiddlyWeb and Tiddlyspace
Install the TiddlyWeb plugin:
pip install -U tiddlywebplugins.twikified
Add the following to tiddlywebconfig.py:
Install this package via NPM then run the twikifier server:
npm install -g twikifier twikifier /tmp/wst.sock
Then start TiddlyWeb/Tiddlyspace
If you have connection problems after a restart, remove
and try again.
To permantly run twikifier, see the next section.
To have twikifier automatically run on start-up and to give more control over starting and stopping it:
Copy the file
Test it can start and stop:
sudo /etc/init.d/twikifier start sudo /etc/init.d/twikifier stop sudo /etc/init.d/twikifier restart
Enable the script to start-up automatically on boot:
update-rc.d twikifier defaults
Credit goes to https://github.com/chovy/node-startup for this.
###Socket File Location
By default, twikifier expects the socket file to live in
/var/run/twikifier. Create this folder, making sure the user running
twikifier can read/write:
mkdir /var/run/twikifier chown user.user /var/run/twikifier
To use another location, add the absolute path as an argument to twikifier in the start-up script.
TiddlyWeb and friends use WikklyText to do sever- side rendering of TiddlyWiki text to HTML. It works, but not great. It has long been thought that a transcoding of the TiddlyWiki wikifier would a) work better, b) be easier to extend and modify.
Also see NOTES.
twikifier was written by Chris Dent and is Copyright 2011-2013, Peermore Limited using a New BSD License. Thanks to Ben Paddock for packaging things for the npm world.