Custom innerwiki widget implemented in pure wikitext

I have implemented a custom $inner.wiki.iframe widget in less than 40 lines of wikitext. It is similar to, but has fewer features than the official $innerwiki widget. Example use:

<$inner.wiki.iframe>
<$data title="test tiddler" text="hello from inner"/>
<$data title="tiddler with script close tag" text="This can wreak havoc if not properly escaped: </script>"/>
<$data title="$:/DefaultTiddlers" text="[[test tiddler]] [[tiddler with script close tag]]"/>
</$inner.wiki.iframe>

See it live at the tiddlywiki share site.

To use it for yourself, drag the $:/plugins/btheado/innerwiki/widget from the above linked share site to your own wiki.

Some notes:

  • The widget supports height, width, and innerwiki-template attributes.
  • It automatically disables all savers except for the download saver to avoid overwriting your outer wiki.
  • The tiddler script tag is prepended to the iframe html. This means the html is not strictly valid html. However, browsers interpret it liberally and it seems to work. One upshot of this approach is it avoids the external core implant bug the official $innerwiki widget has (see Can InnerWiki create wikis that use the external core? - #22 by btheado)
  • I haven’t tested very extensively. YMMV.
1 Like

Another approach, I have implemented earlier, is passing from the parent, the tiddler which stores the filename to which to save to. Sorry I don’t recall what it is.

$:/config/SaveWikiButton/Filename

In the code I shared, you could replace this line:

<$data $filter="[all[shadows+tiddlers]module-type[saver]] -$:/core/modules/savers/download.js" module-type=""/>

with something like this:

<$data title="$:/config/SaveWikiButton/Filename" text=<<currentTiddler>>/>

See also Developers ... have you used InnerWiki?.