3 ms·
Unfortunately no, it isn't shareable given company policy. The approach that I took was very low tech. I literally copy and pasted React code into <pre><code>
by dsiegel2275 11y ago
Unfortunately no, it isn't shareable given company policy.
The approach that I took was very low tech. I literally copy and pasted React code into <pre><code> blocks so that reveal.js would render my example code (and apply the nice source highlighting). In addition, I placed another, identical copy of the code in a script tag and rendered the component into a div on that same reveal slide. So the viewers of the presentation end up seeing the nice highlighted source snippet and the resulting component running live on the slide.
This double copy and paste approach worked fine when I was dealing only with that one presentation, which had maybe six or seven live running examples. But for the curriculum I expect there to be an order of magnitude more examples, so I'm working now on creating a React component that encapsulates inline examples. My idea is to have this React component async fetch the code to display from a .js file on disk. It can then dynamically populate the <pre> and <code> tags and also then babelify, eval, and then render the actual instance of the example component into the dom.
- joshschreuder 11y agoNo worries, thanks for detailing it though. It sounds interesting, I might try to do something similar where I work, or at least have a play around with RevealJS as it sounds pretty cool!