Open HTML pages in Logseq

Dragging different files into Logseq adds them to Assets folder and allows to open them either in Logseq itself like PDF or externally, if it’s a MS Word document for example. But this doesn’t work for HTML files.

And it would be nice and has an actual usecase. A friend of mine wrote a simple script to convert cyrillic morphology that I often use when working with Logseq. Now I have to keep this file on my desktop to open it in browser when needed, put some data in, copy the output and put it back in Logseq. It would be great if I could just drag a file to Logseq page and have a clickable link that opens it right in the side panel of Logseq. This would allow to expand Logseq with all types of quick tools without actually writing a fully-functional plugin.

Agreed. This would be awesome.

Could use either the console (through Ctrl + Shift + i) or custom.js to enter something like this:

document.getElementById("right-sidebar").prepend(document.createElement("iframe"))
document.getElementById("right-sidebar").firstElementChild.setAttribute("src", "file:///C:/path/to/some/file.html")

Can also:

  • open pages from the web:
    document.getElementById("right-sidebar").firstElementChild.setAttribute("src", "https://some.address")
    
  • adjust the height:
    document.getElementById("right-sidebar").firstElementChild.style.height = "50%"
    
  • remove it:
    document.getElementById("right-sidebar").firstElementChild.remove()
    
  • anything else