diff --git a/readme.md b/readme.md index 9ac51b10b..1d6b216de 100644 --- a/readme.md +++ b/readme.md @@ -13,14 +13,14 @@ store.addTiddler(new Tiddler(storyTiddler,{text: navigateTo + "\n" + s The parse tree object exposes the following fields:
var renderer = parseTree.compile(type); // Compiles the parse tree into a renderer for the specified MIME type
 console.log(parseTree.toString(type)); // Returns a readable string representation of the parse tree (either text/html or text/plain)
 var dependencies = parseTree.dependencies; // Gets the dependencies of the parse tree (see below)
-

The dependencies are returned as an object like this:
{
+
The dependencies are returned as an object like this:
{
 	link: {"tiddlertitle1": 2, "tiddlertitle2": 3},
 	include: {"tiddlertitle3": 5},
 	dependentAll: false
 }
 
The link and include fields are hashmaps of the title of each tiddler that is linked or included in the current one. For the tiddler to be subsequently rendered correctly, the linked tiddlers must be present, at least in skinny form, and the included tiddlers must be fully loaded.

The dependentAll field is used to indicate that the tiddler contains a macro that scans the entire pool of tiddlers (for example the <<list>> macro), and is potentially dependent on any of them. The effect is that the tiddler should be rerendered whenever any other tiddler changes.

Rendering

The parseTree.compile(type) method returns a renderer object that contains a JavaScript function that generates the new representation of the original parsed text.

The renderer is invoked as follows:
var renderer = parseTree.compile("text/html");
 var html = renderer.render(tiddler,store);
-

The tiddler parameter to the render method identifies the tiddler that is acting as the context for this rendering — for example, it provides the fields displayed by the <<view>> macro. The store parameter is used to resolve any references to other tiddlers.

Rerendering

When rendering to the HTML/SVG DOM in the browser, TiddlyWiki5 also allows a previous rendering to be selectively updated in response to changes in dependent tiddlers. At the moment, only the WikiTextRenderer supports rerendering.

The rerender method on the renderer is called as follows:
var node = document.getElementById("myNode");
+
The tiddler parameter to the render method identifies the tiddler that is acting as the context for this rendering — for example, it provides the fields displayed by the <<view>> macro. The store parameter is used to resolve any references to other tiddlers.

Rerendering

When rendering to the HTML/SVG DOM in the browser, TiddlyWiki5 also allows a previous rendering to be selectively updated in response to changes in dependent tiddlers. At the moment, only the WikiTextRenderer supports rerendering.

The rerender method on the renderer is called as follows:
var node = document.getElementById("myNode");
 var renderer = parseTree.compile("text/html");
 myNode.innerHTML = renderer.render(tiddler,store);
 // And then, later: