How I Stopped Worrying and Learned to Love Javascript
So I love Jupyter Book. It’s a great way to build a beautiful website with Python. You can add beautiful interactive charts with one of the many plotting libraries supported by Python such as Bokeh or Plotly.
But if you want to make things REALLY interactive, you need to add some Javascript. Holoviz Panel allows you to embed Javascript callbacks to charts and widgets which can then be added to Jupyter Book. It’s great! I’ve been experimenting with Panel for a while, but I ended up learning so much Javascript that I started wondering why I don’t just do everything in Javascript.
But then I remembered the beautiful LaTeX PDF documents I created with Jupyter Book, and decided to stick with Python.
But then I learned about Myst JS! And I thought, what if I build a website in Javascript and used Myst JS to convert it to PDF!?
It Worked!
Some More Markdown
undefined
I can do equations with :
Also inline: So far so good!
What about this Javascript components?
Going to try using Mathlifier. Incidentally, Markdown links don’t work inside slots either.
Codeblocks seem to work fine
import { onMount } from 'svelte';
let headerText;
export let plotHeader = '';
export let data = [{
x: ['giraffes', 'orangutans', 'monkeys'],
y: [20, 14, 23],
type: 'bar'
}];
onMount(() => {
headerText = 'A Chart !';
let plotDiv = document.getElementById('plotDiv');
let Plot = new Plotly.newPlot(plotDiv, data, {}, {showSendToCloud:true});
});
Credits
This website was built with SvelteKit, Skeleton, Tailwind, Plotly, MDsveX, rehype-katex-svelte, remark-math and MyST!