Advanced html snapshot
See original GitHub issueI have to include multiple K3D plots into a sphinx documentation page. I thought I could insert the snapshot html file with:
.. raw:: html
:file: figs/tut/fig-01.html
But it doesn’t work, in the console i see this error:
Uncaught ReferenceError: pako is not defined
Uncaught Error: Mismatched anonymous define() module: function(e){"use strict";var t=(e,t,i,n)=>{let a=65535&e|0,r=e>>>16&65535|0,s=0;for(;0!==i;){s=i>2e3?2e3:i,i-=s;do{a=a+t[n++]|0,r=r+a|0}while(--s);a%=65521,r%=65521}return a|r<<16|0};const i=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());var n=(e,t,n,a)=>{const r=i,s=a+n;e^=-1;for(let i=a;i<s;i++)e=e>>>8^r[255&(e^t[i])];return-1^e};var a=function(e,t){let i,n,a,r,s,o,l,d,f,h,c,u,w,b,k,m,_,g,v,p,y,x,E,R;const A=e.state;i=e.next_in,E=e.input,n=i+(e.avail_in-5),a=e.next_out,R=e.output,r=a-(t-e.avail_out),s=a+(e.avail_out-257),o=A.dmax,l=A.wsize,d=A.whave,f=A.wnext,h=A.window,c=A.hold,u=A.bits,w=A.lencode,b=A.distcode,k=(1<<A.lenbits)-1,m=(1<<A.distbits)-1;e:do{u<15&&(c+=E[i++]<<u,u+=8,c+=E[i++]<<u,u+=8),_=w[c&k];t:for(;;){if(g=_>>>24,c>>>=g,u-=g,g=_>>>16&255,0===g)R[a++]=65535&_;else{if(!(16&g)){if(0==(64&g)){_=w[(65535&_)+(c&(1<<g)-1)];continue t}if(32&g){A.mode=12;bre…
makeError https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js:1
...
I think the requirejs included with the snapshot is in conflict with the requirejs of the documentation page.
Would it be possible to create an advanced snapshot that:
- separates the different javascript libraries into their own files. For example,
pako.js
,k3d.js
… In doing so, when multiple plots need to be included in the same document, the overall file size would be (potentially) much smaller. - It assigns a unique ID to the wrapper div, maybe some kind of hash based on the data, or an option passed in by the user. In doing so, it minimizes the overall chances of conflicts when including multiple plots in the same document.
- Allows the possibility to create an html file without the html/head/body tags. This will create a file ready to be inserted into other documents.
- It minimizes all the output files.
For reference, Plotly does something similar with the Interactive HTML export, by setting fig.write_html(path, include_plotlyjs="require", full_html=False)
. The html files created with that command are ready to be inserted into a documentation page: it works like a charm.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Advanced SEO for JavaScript Sites: Snapshot Pages
As JavaScript becomes ever more integrated with HTML on the Web, SEOs need to develop an understanding of how to make JavaScript sites...
Read more >EBS Snapshot | Create - AMS Advanced Change Type ...
Information about the AMS change type with the classification Deployment | Advanced stack components | EBS snapshot | Create.
Read more >How to take screenshot of a div using JavaScript
The below steps show the method to take a screenshot of a <div> element using JavaScript. Step 1: Create a blank HTML document....
Read more >IBM Spectrum Protect Snapshot overview
IBM Spectrum Protect Snapshot provides a method to back up and restore data by using the advanced snapshot technologies of storage systems.
Read more >Snapshot testing — expect_snapshot • testthat
Snapshot tests (aka golden tests) are similar to unit tests except that the expected result is stored in a separate ... Variants are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hi @Davide-sd @artur-trzesiok
Since I found this issue when looking into integrating
k3d
into a sphinx documentation I just wanted to let you know that as ofk3d=2.12
the interactive output now also works in jupyter notebooks when usingnbsphinx
to convert/integrate the notebooks into the documentationI simply have a notebook containing the k3d plot code that is normally displayed in JupyterLab when I work on the notebooks - super easy! have a look: https://weldx.readthedocs.io/en/latest/tutorials/01_03_geometry.html#Export-3d-geometry-into-a-CAD-file
Thanks @artur-trzesiok for your work, really appreciated.