Roll +Style
If you're reading this blog, chances are you're interested in TTRPG. And in TTRPG, we often find what are called random tables. I've designed a few myself, and find it an interesting exercise. And I may be talking more about them in the coming months.
So I thought it would be nice to be able to put them on the blog. And I've coded myself a little script to do just that. Roll+Style.
The idea is that by simply putting a numbered list in an article, I can effortlessly transform it into a random table. This script lets me do just that. It works on the HTML code generated for a page, but everything starts with my markdown code:
<div class="random-table-header">Random Items</div>
1. Item 1
2. Item 2
3. Item 3
4. Item 4
From this code, my blog engine will generate html :
<div class="random-table-header">Random Items</div>
<ol>
<li>My item 1</li>
<li>My item 2</li>
<li>My item 3</li>
<li>My item 4</li>
</ol>
And the script will take over from there!
- Item 1
- Item 2
- Item 3
- Item 4
Bonus: the header is clickable, and will randomly highlight one of the table items!
It's open-source, available on github (waiting for better).