Existing Tutorials for Adding External Libraries

65 views
Skip to first unread message

Diego Mesa

unread,
Jan 18, 2018, 11:02:15 AM1/18/18
to TiddlyWiki
Hello All,

I am wondering if anyone knows of any existing tutorials/examples of adding and using external libraries within TW. I've found some examples to study, but its slow going (for me).

Best,
Diego

oxydum

unread,
Jan 18, 2018, 1:48:18 PM1/18/18
to TiddlyWiki
Hi,


Cheers

Mark S.

unread,
Jan 18, 2018, 2:55:12 PM1/18/18
to TiddlyWiki
I can tell you the clunky way I did it for the Fountain parser.

I took the entire code for the fountain javascript library and put it in a tiddler:

$:/plugins/MAS/fountain/fountain.js

I marked it

type: application/javascript
module-type:
library

Inside the parser/wrapper I referred to the code like this:

var fountain = require("$:/plugins/MAS/fountain/fountain.js");

and was then able to use fountain.parse(text) directly (which was the only thing I needed from the code).

Perhaps someone can explain a better way of doing this -- particularly if you want to leave the library on the disk so it doesn't bloat your TW.

Good luck!
-- Mark

var fountain = require("$:/plugins/MAS/fountain/fountain.js");
Reply all
Reply to author
Forward
0 new messages