Yeah, I changed the placeholder style so I could readably add an ID number which would have the placeholder text correspond to a value in the array. I did make it a point to amend the length to make sure the proper amount of padding was added though.
If I were doing ReMarkable from scratch in JS (where closures are cheap), I would instead chunk the content in to multi-level object arrays, based on type.
This is a good idea. I'll try to get to work on that.
I definitely realize the major flaws that you're pointing out. My main goal was just to get it working at first. I rewrote it line-by-line originally, and then ran it for the first time. After fixing the slew of errors, I went back and started revising it, seeing how I I could do things better for JS. I actually ended up rewriting it again (after writing it the first time, I gathered a better understanding of how it worked). I will go back and work on it some more soon. I need to “recover” after that one night though, hehe. (I sometimes almost think it might be easier or more foolproof to write a real parser for this when it comes to JS.)