[script] singlefile2trilium: Save faithful copy of a web page with SingleFile web extension. #9366
Replies: 16 comments
-
|
Looks nice, this should be part of Trilium for sure, maybe the web clipper can also have an option for this. I get a parsing error at 30 it says unexpected token api in Trilium, not sure maybe it is just an editor thing. Edit: I tried it and it does not seem to work for me, no file is imported. I am pretty sure I set it up correct with the py script and the js script. I have 2 html files in the folder and I see no activity on the .py script shell. I think the script never reaches |
Beta Was this translation helpful? Give feedback.
-
|
You are probably using trilium v0.37.X, as singlefile2trilium's README says, singlefile2trilium depends on trilium >= v0.38 (latest beta). Otherwise, you must ensure that the .py script has This is because i use the new refactored API (which is less confusing & more complete) |
Beta Was this translation helpful? Give feedback.
-
SingleFile is a bit complex extension. One possibility would be to fork SingleFile into a |
Beta Was this translation helpful? Give feedback.
-
|
I use the 0.38 LIke I said I think something about the scanning in the .py script makes the import impossible because I made a hack version of it and feed the .html manually then all works and the js backend extension seem to do its job. I will take a look at the .py script to see why it is failing on my system. |
Beta Was this translation helpful? Give feedback.
-
|
Okay, i would like very much to know what's going wrong, so keep me updated if u find. keep in mind that the script has filters to ONLY process html files generated by singlefile. for this, i check that the singlefile html comment is inside the page's content. So maybe on chrome, or with different singlefile configuration, this html comment is not written in the page. If so, the file will not be recognized by the script as a 'singlefile' file |
Beta Was this translation helpful? Give feedback.
-
|
how to import a 'singlefile' file to trilium and render it prettily like yours manually? |
Beta Was this translation helpful? Give feedback.
-
|
Hi ! You go here: https://github.com/nil0x42/singlefile2trilium and follow the instructions. |
Beta Was this translation helpful? Give feedback.
-
|
Do you know any way to make Trilium to respect the page format when importing singlefile htmls? As of now all the images are messed up and they break the page formatting badly, like all images are centered vertiocally and do not allow multiple images side by side (which I something I reported as well). The singlefile output looks good, but looks terrible inside Trilium :( |
Beta Was this translation helpful? Give feedback.
-
|
@gerroon it might look terrible, but having an inline iframe containing the contents of singlefile is the only way i kow to have a formatting totally independent from the html classes of trilium. If your goal is to have the exact same formatting as original page, singlefile2trilium is the way to go. I have written singefile2trilium exactly to automate that wrapping of singlefile's htmls into an inline iframe to have it rendered nicely into trilium, check-out https://github.com/nil0x42/singlefile2trilium |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the reply. Why does not Trilium by default capture the pages into iframe by default then? It seems to me that the results are superior. |
Beta Was this translation helpful? Give feedback.
-
The answer is that it is simply not a goal to capture pages with all the design details, the goal is rather to extract the actual semantic content with minimal styling. |
Beta Was this translation helpful? Give feedback.
-
|
Well sure but that is really debatable in my view, styling affects how we perceive information. A broken style in a document makes the information less legible in my opinion. The current capture is good for text but not so for mixed content to be honest. Joplin offers a "full html" capture of the page as well beside that markdown based one, I personally think that having an option to capture the styling on top of the information to bea really good option. I have to resort to that option in Joplin here there. |
Beta Was this translation helpful? Give feedback.
-
|
that's why i made singlefile2trilium, this hack allows integrating fully rendered pages in your trilium. At start i though about forking singlefile addon to fully integrate with trilium, but the development cycle of singlefile is too high to be easily forkable while maintaining upstream updates in the long term. That's why i chose to make an external script. |
Beta Was this translation helpful? Give feedback.
-
|
I like this addition for sure, I am slowly trying to rethink my flow around this. Also a weird question, do you think a Tiddlywiki html file can be properly embedded in Trilium? |
Beta Was this translation helpful? Give feedback.
-
|
@gerroon tiddlywiki was indeed how i got the idea to embed the singlefile contents into an iframe. I mostly copy-pasted the way they do. |
Beta Was this translation helpful? Give feedback.
-
|
Hm, we really do need a 'store' for these :) I've added a 'Script' type to allow filtering issues by them. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
That's not a real issue, but more like an advertising to communicate about an integration SingleFile -> Trilium i just pushed here: https://github.com/nil0x42/singlefile2trilium
It allows the user to save a faithful copy of a web page in Trilium notes with SingleFile web extension:

Anyway, as trilium grows, and with it's obviously great capacity to adapt and be scripted in many ways, maybe a Wiki page dedicated to external trilium scripts & resources could be useful to help newcomers to get on overview of how one can adapt trilium to its specific needs.
Because guys like be writing scripts they wish to release are happy to share them with other trilium users, and from now the only way i got was to post an issue (and that's not the purpose of issues).
Beta Was this translation helpful? Give feedback.
All reactions