tuxu/ipynb-quicklook

Doesn't work without internet connection

Closed this issue · 0 comments

d8xa commented

I noticed that the extension doesn't work without internet access. Without internet it just shows a blank page.
I'm not well versed in HTML, but it's obvious to me that the template.html file relies on external resources from Cloudflare servers:

<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism.min.css' />
<script src='https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.6/marked.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/prism.min.js' data-manual></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/components/prism-python.min.js' data-manual></script>

This seems like a big design flaw, for multiple reasons:

  • Obviously, quicklook shouldn't need an internet connection to display offline content
  • even though Cloudflare is incredibly reliable, relying on an external source introduces another point of failure
  • and most importantly, it doesn't allow the user to use a custom local stylesheet

Is there a way to include the files locally?
I could be wrong, but theoretically it should be possible to put them in the same directory as the html, and then include them via relative paths. I tried many different pieces of advice I found on various forums on this topic, such as

src='file:///{filename}.'
src='../{filename}'
src='{filename}'
src='assets/{filename},

where {filename} stands for the filename and assets is a folder. But none worked.

My ugly solution: Including the Javascript code inline inside the <script></script>tags.
it works, but it's ugly and lack modularity.
I'd appreciate any input, even if it's just a hint, how to to it with src attributes.

And even this "solution" leaves me with the problem how to include a local CSS stylesheet. From what I read, it should be possible to do, although I'm afraid this is beyond my rudimentary HTML knowledge.
Any help would be greatly appreciated.

Edit: just noticed a browser extension changed all mentions of "Cloudflare" to "Buttflare". Oops...