> I'm not having much luck searching the web, and I'm hoping somebody can put 
> me on some kind of "for white belts" reading material.
> 
> Say one finds a small javascript library one wants to use with TiddlyWiki, 
> what are the options and the processes involved?
> 
> Does one include the libary (if so where?) in TiddlyWiki, then access the 
> libary functions via javascript macros ?
> 
> Total newb here with the whole concept, and not particularly knowledgeable 
> about javascript, so please be gentle !

It depends what the JS library does.

If the library does pure text manipulation (eg an anagram engine), then it 
should be fairly easy to wrap it up into a JavaScript macro. There are some 
examples here:

https://github.com/Jermolene/TiddlyWiki5/tree/master/core/modules/macros 
<https://github.com/Jermolene/TiddlyWiki5/tree/master/core/modules/macros>

If the library converts markup to HTML, then it can be wrapped to be a parser - 
see the Markdown parser or the KaTeX parser for an example:

https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/katex/latex-parser.js
 
<https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/katex/latex-parser.js>
https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/markdown/wrapper.js
 
<https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/markdown/wrapper.js>

Things get much trickier if the library manipulates the DOM. One fundamental 
problem is that many libraries are written on the assumption that they will be 
used on a static page, and don’t automatically cater for dynamic content. In 
many cases, such libraries are old jQuery libraries that do things that can now 
be done with plain HTML or wikitext.

The simplest case is a library that produces output in a single DOM node. These 
can generally be turned into a widget. For example, the CodeMirror widget:

https://github.com/Jermolene/TiddlyWiki5/tree/master/plugins/tiddlywiki/codemirror
 
<https://github.com/Jermolene/TiddlyWiki5/tree/master/plugins/tiddlywiki/codemirror>

That is not an exhaustive list, what kind of library are you looking at?

Best wishes

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/F6928D64-1D81-4B68-BC3F-8B53E5B9A055%40gmail.com.

Reply via email to