Creating a standalone TiddlyWiki from the command line

Hi everyone,

I am trying to create a standalone TiddlyWiki file from the command line (via Node.js). From information I gathered from various sources, the way to do this seems to be “rendering” a special tiddler called $:/core/save/all. Fine. Except that this doesn’t quite do what I’d expect.

A quick test:

tiddlywiki --load empty.html  --render $:/core/save/all index.html

where empty.html is a freshly download TiddlyWiki file. This command produces a file output/index.html, but it contains the HTML code rendered as text inside a paragraph tag:

$ head output/index.html

<p>
<code>&lt;!doctype html&gt;
</code>&lt;!-- The following comment is called a MOTW comment and is necessary for the TiddlyIE Internet Explorer extension --&gt;
&lt;!-- saved from url=(0021)https://tiddlywiki.com --&gt;
<code>&lt;html lang="</code>en-GB<code>"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
&lt;!--~~ Raw markup for the top of the head section ~~--&gt;
</code><code>
&lt;meta http-equiv="X-UA-Compatible" content="IE=Edge"/&gt;

Am I missing something obvious?

Try:

tiddlywiki --load empty.html --render $:/core/save/all index.html text/plain

That last parameter is the render type. The default is text/html which saves the entire generated HTML tree, including all HTML tags. text/plain just saves the text content of the HTML tree. Most of the core templates expect to be rendered as text/plain.

Thanks a lot, that works fine! And after some reflection, it makes sense, though at first it looks paradoxical to ask for text/plain if what you want is HTML code.