Can external .mhtml files be displayed in Tiddlywiki like external img files?

336 views
Skip to first unread message

Sapphireslinger

unread,
Mar 23, 2021, 3:18:38 AM3/23/21
to TiddlyWiki
I like to save my favorite web articles to my note-taking tiddlywiki. 

For plain text I love Tiddlyclip. But when I want to preserve the formatting I also use the firefox extension Copycat to copy and paste the html of a selection into the tiddler (and I worry about the safety of pasting who-knows-what code into a tiddler - but this is a side question). 

However, recently I discovered that the Brave browser on my Android mobile has a button to download a webpage as an .mhtml file.  

Could I treat the downloaded .mhtml files like my external img files and just call for them like calling for an external img, for example something similar to [img[foo.mhtml]] or [ext[Open file|/foo/foo/foo.mhtml]]?

That way the .mhtml files would be stored outside the tiddlywiki (no bloat) and merely viewed when called for. Is there a way to do this? And is it safer?

* I tried [ext[Open file|/foo/foo/foo.mhtml]] and it just opened a page of code, no website. (I was trying to access a downloaded .mhtml file using Tiddlywiki on Firefox on my desktop computer running Linux Mint). 

* I tried renaming the link and the file to .html instead of .mhtml and it just keeps "loading..."

I tried opening the file directly on my computer (not going through Tiddlywiki) by right-clicking on the file and choosing to open with firefox, and it only works if the file extension has been changed to .html.

I would be happy to hear what experiences people have had with .mhtml files and Tiddlywiki.

Sapphireslinger

unread,
Mar 23, 2021, 3:20:54 AM3/23/21
to TiddlyWiki
More accurately the link I tried was [ext[Open file|Webpages/foo.mhtml]]

Jeremy Ruston

unread,
Mar 23, 2021, 4:33:01 AM3/23/21
to tiddl...@googlegroups.com
It may be worth trying to use an iframe to view the documents. Untested, but something like this may work:

<iframe src="Webpages/foot.mhtml" width=600 height=600/>

Best wishes

Jeremy


On 23 Mar 2021, at 07:20, Sapphireslinger <sapphir...@gmail.com> wrote:

More accurately the link I tried was [ext[Open file|Webpages/foo.mhtml]]
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/ab769038-d4e1-4425-87aa-980125873a29n%40googlegroups.com.

TW Tones

unread,
Mar 23, 2021, 6:28:07 AM3/23/21
to TiddlyWiki
Sapphireslinger

Perhaps you can share a minimal mHTML file for us to experiment with?

Tones

Jeremy Ruston

unread,
Mar 23, 2021, 7:22:31 AM3/23/21
to tiddl...@googlegroups.com
Chrome desktop can also save webpages in MHTML format.

I’ve subsequently researched a little and it looks like they may be explicitly blocked from display in an iframe.

Best wishes

Jeremy

Mark S.

unread,
Mar 23, 2021, 9:49:54 AM3/23/21
to TiddlyWiki
HTML has a lot of excess code. But if you're using copycat, you can copy the file contents as Markdown. The new markdown plugin updates allows some use of wikitext, so you can now have the best of both worlds. Markdown, like wikitext, is very lightweight, and you lose the incredible bloat of HTML -- and the dangers of hidden code.

Sapphireslinger

unread,
Mar 24, 2021, 8:23:14 AM3/24/21
to TiddlyWiki
Thank you Jeremy for looking into it!

Tones, I started to look for an mhtml file to send, but choosing one has me frozen for the present. 

Mark, I tried Copycat Markdown and it is a step up from plain text but still looks messy, not the neat formatting of html. I will however use markdown from now on instead of html since you confirmed the bloat and insecurity. Now I just have to find all those bookmarks with html to delete.

Thank you all for the info!

Sapphireslinger

unread,
Mar 25, 2021, 12:10:56 AM3/25/21
to TiddlyWiki
Woohoo! It works with plain html files. Closest I've been able to get to Evernote Web Clipper!

If it is a true html file, and not just me deleting the first "m" out of the .mhtml file name, then both of these work:

[ext[Open file|Webpages/foo.html]]

<iframe width="560" height="315" src="Webpages/foo.html" frameborder="0" allowfullscreen></iframe> 


1. But is it safer than pasting the raw html into a tiddler? Does it being embedded in an iframe somehow make it safer? (And is it non-bloating?)

2. Can I modify Tiddlyclip to automatically include <iframe width="560" height="315" src="Webpages/{{!!Title}}.html" frameborder="0" allowfullscreen></iframe> in every tiddler Tiddlyclip creates? Is {{!!Title}} how it should be written?

3. Do I really need the 560 and 315? I will try leaving them out.

P.S. I can also see how .mhtml would have been the ultimate in formatting above even .html, because as I understand now, the .mhtml is a SINGLE FILE package of what used to be two separate things: the .html file with its ancillary media folder (i.e. what was created when a person used to click "save as complete webpage"). But until .mhtml embedding becomes possible, .html is already great.

Sapphireslinger

unread,
Mar 25, 2021, 8:24:10 AM3/25/21
to TiddlyWiki
I was going to try <iframe width="560" height="315" src="Webpages/{{!!caption}}.html" frameborder="0" allowfullscreen></iframe> because Tiddlyclip already automatically creates a caption field for each tiddler ... and then I noticed that the title Tiddlyclip grabbed to put in the caption field is different than the name the browser puts on the html file of a webpage.

Tiddlyclip automatic captioning: Scientists’ Lab Creations Of Living ‘Model Embryos’ Raise Ethics Questions : The Daily Wire
Desktop Firefox browser saves the webpage as: Scientists’ Lab Creations Of Living ‘Model Embryos’ Raise Ethics Questions | The Daily Wire.html
Desktop Brave browser saves the webpage as:  Scientists’ Lab Creations Of Living ‘Model Embryos’ Raise Ethics Questions _ The Daily Wire.html

Conclusion: 

It would be hard for Tiddlyclip to automate this as everybody uses different browsers. 

I don't know how to tweak this to be automated even if I choose one browser to stick with.  

BJ

unread,
Mar 26, 2021, 3:32:37 PM3/26/21
to TiddlyWiki
Note that tiddlyclip can clip html as well as text. In fact various information is scraped from the webpage being clipped and placed into variables that are sent to the tiddlyclip tiddlywiki plugin, one being called 'web', containing the clipped html. To use this set up a new rule in a new tiddler like so:

htmlclip.png
Then use this in your tiddlyclip config tiddler:


clipconf.png

BJ

BJ

unread,
Mar 26, 2021, 4:56:10 PM3/26/21
to TiddlyWiki
Actually under windows both '":" and "|" are illegal in file names, see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

The true page title is 'Scientists’ Lab Creations Of Living ‘Model Embryos’ Raise Ethics Questions | The Daily Wire.html' but the '|' needs to be avoided in tiddlywiki titles so tiddlyclip changes it to ':'.  This can be changed to another character by modifying the rule to substitute the ':' with another character.

BJ


On Thursday, March 25, 2021 at 1:24:10 PM UTC+1 Sapphireslinger wrote:

Sapphireslinger

unread,
Mar 29, 2021, 9:58:41 PM3/29/21
to TiddlyWiki
BJ, 

Thank you for the html option for Tiddlyclip. I tried it today and I think I can get rid of my Copycat add-on to Firefox! 

However it has the same limitations of Copycat: 

I can not select an entire web article and then expect that everything will be carried over into Tiddlywiki. 

Regardless of Snip, Html, or Copycat, I will sometimes open the resulting tiddler to find only one or two paragraphs copied instead of the entire article, I guess because some webpages have underlying partitioning code that derails the copy process.

I would have to snip/html paragraph by paragraph which is too time-consuming.

So while Tiddlyclip with html is presently a great substitute for Copycat when it comes to a few lines or paragraphs, I do not yet have the skill to configure it to be the second coming of Evernote Web Clipper for entire articles.

I ended up saving the webpage as html and calling it into a tiddler via iframe.

However thank you so much for helping me get rid of Copycat! 

The maker of Copycat is probably a great person and I don't know if the add-on is open source or not, but Tiddlywiki I know has a great community and is very transparent.

TW Tones

unread,
Apr 4, 2021, 1:30:16 AM4/4/21
to TiddlyWiki
Quick tip

You can use width="100%" in iframes to make use of the available space.

I have used a range of firefox plugtins over the years some of which copy and save html very nicely. If not too large pasting strait into a tiddler may be fine.

If you save a full html site to a subfolder, including images and Javascript etc... you can sometimes host a html page in a tiddler that is fully functional, if not breaking the single file model.
 

Tones
Reply all
Reply to author
Forward
0 new messages