nimiSlide is a library for making presentations about Nim, in Nim. It's a nimib theme which uses Reveal.js to make the slideshows. But you don't have to write a line of neither HTML nor Javascript to use it, it's all Nim code for the user.
You can view the presentation from the video yourself here and the source code can be found here.
nimiSlides has support for many of the Reveal's features:
We are also developing our own custom components that aren't bundled with Reveal:
The imports and setup you need:
import nimib
import nimiSlides
nbInit(theme = revealTheme)
The basic building block of a slideshow is the slide template. If you want an ordinary horizontal (βοΈ) slide, use a single level of slide: like this:
slide:
nbText: "This is the first slide"
slide:
nbText: "This is to the right of the last slide"
If you want to use slide vertical (βοΈ) slides, you nest it two levels instead:
slide:
slide:
nbText: "This is at the top"
slide:
nbText: "And this is below it"
# You can of course mix them:
slide:
nbText: "And this is to the right of them"
Reveal.js has really pretty step-by-step animation of code blocks which can be used in nimiSlides like this:
slide:
animateCode(1, 3..4, 5):
echo "First this!"
echo "But not this!"
echo "Then..."
echo "...these"
echo "And last this!"
The arguments to animateCode are the order to highlight the different lines of code. In this case the first line will be highlighted first. Then the third & fourth together and lastly the fifth line.
If you want to reveal different parts of your slide when you step forward, for example revealing a list item at a time, then you should checkout fragments. If you simply want to fade-in the different parts you can use fragmentFadeIn like this:
slide:
fragmentFadeIn:
nbText: "Show this first"
fragmentFadeIn:
nbText: "Show this afterwards"
You can also use the more fundamental fragment which accepts any of these animations:
slide:
fragment(highlightBlue):
nbText: "This will be blue"
If you want to apply multiple animations at the same time, you can pass them in all at once:
slide:
fragment(highlightBlue, grows):
nbText: "This will be blue AND grow"
If you want to apply multiple animations after each other, you must use the seq-overload:
slide:
fragment(@[highlightBlue], @[grows]):
nbText: "This will be blue and THEN grow"
Each seq will be executed one at a time, so first it will turn blue and on the next step it will grow.
Fragments can also be played after others has been performed:
slide:
fragmentEnd(semiFadeOut):
fragmentFadeIn:
nbText: "Show this first"
fragmentFadeIn:
nbText: "Show this afterwards"
After the two fadeIn-animations has been shown, both of them will semiFadeOut.
There are more features mentioned in the README and used in the showcase at the top. Please try it out and let me know if you have any questions :D
Great job Hugo! πππ
Looking forward to use it! β¨
Thanks Pietro π
Feel free to share any slideshows you make using nimiSlide in this thread. I want to see them all π€©
The latex equations support may make it a great replacement of beamer, latex package for presentation. Is it possible to get the current slide number over the total number of slides ?
I see that the slides are not disposed in a linear way (according to the arrows on the down-right corner). I am curious, how are the errors handled ? With nim over this js backend using katex or mathjax for latex equations, can I get a correct error message when making a typo in my equation ?
Can we have text in blocks side by side ? Is it possible for the user to define (color ?) blocks, one each for definition, theorem, or proposition or example ?
I guess that for this, I will have to dive into JS anyway and make a PR ^^
I will definitely use it to present Nim code. Thanks a lot.
Is it possible to get the current slide number over the total number of slides ?
I have added showSlideNumber() and updated the showcase to include it.
I see that the slides are not disposed in a linear way
Indeed, you have the option to do it vertically and horizontally. The way it walks them is first going down and then going to the next stack to the right. You can do a linear slideshow as well if you want to.
The latex equations support may make it a great replacement of beamer, latex package for presentation. I am curious, how are the errors handled ? With nim over this js backend using katex or mathjax for latex equations, can I get a correct error message when making a typo in my equation ?
It currently uses Reveal.js's Math support (Katex) so all errors are done in the browser I'm afraid. It would be nice having something like LatexDSL though which checks the latex at compile-time. It returns a string, so if we are lucky we could perhaps cross our fingers and hope Katex can render it for us. Otherwise, we would need a Latex -> HTML library in Nim.
Can we have text in blocks side by side ?
It should be totally possible by using CSS at the very least. We have discussed adding a Flexbox/Grid API to nimib here in the future which would solve that. At the moment you would have to roll something yourself by inlining HTML.
Is it possible for the user to define (color ?) blocks, one each for definition, theorem, or proposition or example ?
Totally possible, it just requires a bit of work. If you want to use Katex it supports colors: https://katex.org/docs/supported.html#style-color-size-and-font I would advise you to create a template like this (pseudocode):
template theorem(latex: string) =
nbText: "\[\textcolor{blue}{" & latex & "}\]"
I guess that for this, I will have to dive into JS anyway and make a PR ^^
PR's are very much appreciated :D Most of what you have mentioned here is general enough that they should be done upstream in nimib though and not nimiSlides. Feel free to open an issue there if you have something you can't get working and we'll try and help you out.
I will definitely use it to present Nim code. Thanks a lot.
I'm glad to hear, please share any presentations you create with nimiSlides ^^
I found what was the problem, and its solution.
my file was missing the call to 'nbSave'
nbSave (nimib API), as the name implies, saves the presentation to the html file
That's a good point, will add it to the readme when I get home :)
It's great to get feedback on things like this. I'm so used to nimib and nimiSlides so it's hard sometimes to get into the shoes of someone new to them.
nimiSlides v0.2.3 has been released! It contains multiple quality of life changes as well as the first steps towards a proper documentation. You can see the API docs here. And I have spent time writing tutorials for most of the features of nimiSlides with embedded showcases for each feature. You can find these in a neat nimiBook here. If you have any feedback on the tutorials, please let me know :D.
Here's what have changed: