1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-16 05:00:28 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/concepts/TiddlyWikiFolders.tid

76 lines
2.5 KiB
Plaintext
Raw Normal View History

2013-11-29 12:26:48 +00:00
created: 20130825214200000
modified: 20140206174804112
2013-08-25 21:48:53 +00:00
tags: dev
2013-04-17 15:38:32 +00:00
title: TiddlyWikiFolders
2013-11-29 12:26:48 +00:00
type: text/vnd.tiddlywiki
2013-04-17 15:38:32 +00:00
2013-12-12 09:48:08 +00:00
As well as traditional single file wikis, [[TiddlyWiki on Node.js]] supports wikis that are stored as a folder of individual tiddler files.
2013-04-17 15:38:32 +00:00
! Wiki folder files and folders
Wiki folders can contain the following files and folders:
2013-08-30 19:06:23 +00:00
* ''tiddlywiki.info'' - JSON file containing metadata for the wiki
2013-04-17 15:38:32 +00:00
* ''\tiddlers'' - folder containing tiddler files comprising the wiki
* ''\plugins'' - folder containing [[plugin folders|PluginMechanism]] to be included in the wiki
Only the ''tiddlywiki.info'' file is required, the ''tiddlers'' and ''plugins'' folders are optional. Any files and folders not listed above are ignored.
2013-08-30 19:06:23 +00:00
!! Content of `tiddlywiki.info` file
2013-04-17 15:38:32 +00:00
The `tiddlywiki.info` file in a wiki folder contains a JSON object comprising the following fields:
2013-08-28 19:14:27 +00:00
* ''plugins'' - an array of plugin names to be included in the wiki
2013-04-17 15:38:32 +00:00
* ''includeWikis'' - an array of relative paths to external wiki folders to be included in the wiki
For example:
```
{
2013-08-30 19:06:23 +00:00
"plugins": [
"tiddlywiki/tiddlyweb",
"tiddlywiki/filesystem"
],
"includeWikis": [
"../tw5.com"
]
2013-04-17 15:38:32 +00:00
}
```
2013-08-30 19:06:23 +00:00
!! Content of `tiddlers` folder
All the TiddlerFiles in the `tiddlers` folder are read into the wiki at startup. Sub-folders are scanned recursively for TiddlerFiles.
Sub-folders within the `tiddlers` folder can also be given a `tiddlywiki.files` JSON file that overrides the default processing for that folder. The file format is illustrated with this example from the D3 plugin:
```
{
"tiddlers": [
{
"file": "d3.min.js",
"fields": {
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/d3/d3.js",
"module-type": "library"
},
"prefix": "var d3;if($tw.browser){\n",
"suffix": "}\nexports.d3 = d3;\n"
},
{
"file": "cloud/d3.layout.cloud.js",
"fields": {
"type": "application/javascript",
"title": "$:/plugins/tiddlywiki/d3/d3.layout.cloud.js",
"module-type": "library"
}
}
]
}
```
The JSON data consists of an object with a `tiddlers` property that contains an array of information about each tiddler to be loaded into the wiki. That information consists of:
* `file`: the relative or absolute path to the file to include
* `fields`: an object containing fields that override any provided in the tiddler file
* `prefix` & `suffix`: (optional) specify strings to be prefixed and suffixed to the tiddler file text content