1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-19 16:24:51 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/TiddlyWikiArchitecture.tid

46 lines
2.0 KiB
Plaintext
Raw Normal View History

title: TiddlyWikiArchitecture
modifier: JeremyRuston
2012-06-10 16:27:09 +00:00
tags: docs internals
2013-03-02 13:14:56 +00:00
The heart of TiddlyWiki can be seen as an extensible representation transformation engine for text and images. Given the text of a tiddler and its associated ContentType, the engine can produce a rendering of the tiddler in a new ContentType. Furthermore, it can efficiently selectively update the rendering to track any changes in the tiddler or its dependents.
2012-12-28 23:08:28 +00:00
The primary use of the engine is to convert raw `text/vnd.tiddlywiki` WikiText into a `text/html` or `text/plain` representation for display. The transclusion and templating features of WikiText allow the engine to also be used to generate TiddlyWiki HTML files from raw tiddlers.
2012-06-22 14:45:32 +00:00
You can explore this mechanism by opening the JavaScript console in your browser. Typing this command will replace the text of the tiddler `HelloThere` with new content:
2012-12-28 23:08:28 +00:00
```
2012-06-22 14:45:32 +00:00
$tw.wiki.addTiddler({title: "HelloThere", text: "This is some new content"});
2012-12-28 23:08:28 +00:00
```
2013-02-05 22:11:36 +00:00
If the tiddler `HelloThere` is visible then you'll see it instantly change to reflect the new content. If you create a tiddler that doesn't currently exist (like IntentionallyMissingTiddler) then you'll see any displayed links to it instantly change from italicised to normal:
2012-12-28 23:08:28 +00:00
```
2013-02-05 22:11:36 +00:00
$tw.wiki.addTiddler({title: "IntentionallyMissingTiddler", text: "This tiddler now exists"});
2012-12-28 23:08:28 +00:00
```
2013-03-22 11:05:36 +00:00
This example deletes a tiddler:
```
$tw.wiki.deleteTiddler("HelloThere")
```
This example retrieves all the outgoing links from a tiddler:
```
$tw.wiki.getTiddlerLinks("HelloThere")
```
This example retrieves all the incoming links to a tiddler:
```
$tw.wiki.getTiddlerLinks("HelloThere")
```
This example retrieves the titles of all the tiddlers matching a TiddlerFilter expression:
```
$tw.wiki.filterTiddlers("[tag[docs]sort[modified]]")`
```
2013-03-02 13:14:56 +00:00
If you're interested in understanding more about the internal operation of TiddlyWiki, it is recommended that you review the DeveloperDocs and read the code -- start with the boot kernel [[$:/core/boot.js]].