Skip to content

Instantly share code, notes, and snippets.

@Marc-B-Reynolds
Last active November 13, 2024 04:06
Show Gist options
  • Save Marc-B-Reynolds/27ac2564f26b4bb0f9c1cce87e480c4d to your computer and use it in GitHub Desktop.
Save Marc-B-Reynolds/27ac2564f26b4bb0f9c1cce87e480c4d to your computer and use it in GitHub Desktop.
Single file: markdeep + plotly that mostly works

Header

Some bold text before an inline function: $y = x^2$

NOTE: The gist preview is completely whacked. Click on raw for the source.

  • point 1
  • point 2

and again

  1. point 1
  2. point 2
double foo(double x) { return x*x; }

Section

The only thing I've noticed broken is display functions initially render properly and then jump to being left aligned once plotly completes loading.

$$ \text{cos}\left(\theta\right)$$


<style class="fallback">body{visibility:hidden}</style><script>markdeepOptions={tocStyle:'medium',inlineCodeLang:'c'};</script> <script> // array of 'n' elements: [0,1,..] function make_range(x,n) { return Array.from({length: n}, (_, i) => i+x); } function array_map(src, f) { return src.map(f); } function geo_data(src,p) { const n = src.length; return src.map((i) => p*Math.pow(1-p,i)); } function geo_make(d,n) { return { x:geo_axis, y:d, type:'scatter', mode:'lines+markers', marker:{ size:5 }, name:n }; } const options = {displaylogo: false}; const geo_len = 32; const geo_axis = make_range(0,geo_len); const geo_1 = geo_make(geo_data(geo_axis,0.5),"1/2"); </script> <script> const markdeep = document.createElement('script'); markdeep.src = 'https://casual-effects.com/markdeep/latest/markdeep.min.js'; markdeep.charset = "utf-8"; markdeep.onload = () => { const plotscript = document.createElement('script'); plotscript.src = 'https://cdn.plot.ly/plotly-latest.min.js'; plotscript.onload = () => { const layout = {title: 'test plot' }; Plotly.newPlot('figure1', [geo_1], layout, options); }; document.head.appendChild(plotscript); }; document.head.appendChild(markdeep); </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment