5 ms·
We recently added support for embedding LaTeX expressions (and really, any dynamically-generated DOM) within Markdown template literals to Observable notebooks.
by mbostock 9y ago
We recently added support for embedding LaTeX expressions (and really, any dynamically-generated DOM) within Markdown template literals to Observable notebooks. So you can say md`I like ${tex`\\KaTeX`}`, and KaTeX renders its logo, which is then embedded within the generated Markdown.
I’m admittedly biased, but I love the ease of writing Markdown combined with being able to inline arbitrary DOM for math, sparklines etc. More examples here:
https://beta.observablehq.com/@mbostock/measuring-color-difference https://beta.observablehq.com/@mbostock/measuring-color-diff...
https://beta.observablehq.com/@mbostock/introduction-to-html https://beta.observablehq.com/@mbostock/introduction-to-html
- dunham 9y agoI worked around the inline math issue by doing: md2 = x => md([x[0].replace(/\$(.*?)\$/g, m => tex([m.slice(1,-1)]).outerHTML)]) I do appreciate you adding support for ${tex`...`}, but it's still a bit more verbose than I'd like to type.
- mbostock 9y agoWell, it’s nice that you can always define your own tagged template literal. ;) The double backslashes certainly are annoying. We may be able to eliminate them by using String.raw. https://github.com/observablehq/notebook-stdlib/issues/10 https://github.com/observablehq/notebook-stdlib/issues/10
- dunham 9y agoI just saw that pop up on the front page of observablehq. That resolves another pain point for me. (My first experiment with the platform happened to have a lot of math exposition in it.)
- johnsonjo 9y agoMike, great job on Observable and thanks for all your work on D3 as well! I read through the whole thread about observable that was on hacker news a couple weeks ago, but I didn't see an answer to a question I have. Are there any plans to allow observable to be run locally like a jupyter notebook? Like an app or anything. Even if the site was like a progressive web app that could be nice. I know observable as a whole is not open-source so I understand this may not align with the best interests of the company. Also observable is fairly new so I'm sure you have a lot higher priority features on the release radar. I honestly wouldn't mind paying for an application even if it was an electron app. Anyways good luck with Observable! I think its a great notebook format with a great API.