External Attachments for Plain Text?

Hey folks - I’m having trouble inserting a plain-text file using the External Attachments plugin.

What I’ve tried:

  • install “External Attachments” from the TiddlyWiki plugin librar
  • create a new tiddler of type Plain Text
  • set the _canonical_uri field to test.txt
  • create a test.txt file in the same directory as my wiki’s HTML file
  • relaunch TiddlyDesktop

TiddlyWiki gives me the “I can’t find it” error:

Trying to load external content from test.txt
If this message doesn’t disappear, either the tiddler content type doesn’t match the type of the external content, or you may be using a browser that doesn’t support external content for wikis loaded as standalone files. See https://tiddlywiki.com/#ExternalText

(unfortunately, the ExternalText page on TiddlyWiki is missing…)

I tried using ./test.txt, like in the “Alice in Wonderland” sample from TiddlyWiki.com, but that didn’t help. TiddlyDesktop logs no errors. Adding a .png file that’s in the same folder as the wiki HTML works just fine.

I’m sure I’m missing something - any ideas? Thanks!

@Peter This does not answer your question. Rather, I simply use HTML to reference external files. Example:

<object data="test.txt" width="100%" height="800"></object>

I have used this method too, it displays the content.

  • We can’t [Edited to the negative] then manipulate the content
  • If we need to then manipulate perhaps using the new tm-http-request ?
1 Like

Hi @Peter, I tried something similar recently. As far as I can tell, this works only for tiddlers and not pure text files. The critical line in wikiparser.js is probably this one:

var tiddlers = self.wiki.deserializeTiddlers(".tid",data,self.wiki.getCreationFields());

This tries to load data as one or more .tid files, i.e. files also containing metadata like created and title apart from the text data.

You could add the respective metadata to your file and it would probably be fetched. But, on completion the loaded tiddlers are added to the wiki, i.e. saved into the data folder or the html file, bloating up your wiki. Because the text field is no longer empty, the _canonical_uri field is subsequently ignored.

I don’t think there is a way around that. If it is, I’d like to know.

I went with using skinny tiddlers instead, triggered by a custom tag. This way the .tid files will be somewhere in the wiki folder (in their own folder), but won’t be loaded upon startup until needed and also don’t show up in searches – my usecase is storing raw data for plotting.