How does the addition of new tiddler types work?
From reading the railroad plugin code and the tw-dev pages on Parser and Widget, I gather that it is as simple as creating a new parser module and assigning the newly defined type to a specific widget.
Railroad does it in its super-simple typed-parser.js module:
```
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var RailroadParser = function(type,text,options) {
var element = {
type: "railroad",
tag: "$railroad",
text: text
};
this.tree = [element];
console.log(text);
};
exports["text/vnd.tiddlywiki.railroad"] = RailroadParser;
})();
...
The intent is clear, and the code could not be simpler. It maps the new tiddler type text/vnd.tiddlywiki.railroad to the railroad plugin. But it feels like a bit of magic. Where is that mapping actually established? I have not been able to find how it actually implemented in the core, and I would like to get a better grasp of the overall mechanism. Where should I look?
Cheers,
S.