Wow, that’s a lot of stuff.
It’s good to record all that here, but in the interest of doing one thing at a time, I’m going to try to focus on the requirements for the editor:
[quote=“mdinger, post:6, topic:5319”]I would note that not all projects may want to use editable code examples; they might want the option to choose which they want to use. For example, the book has traditionally not had editable examples and they might like the option for it to stay that way. They also might like the fact that non-editable is more lightweight.
[/quote]
You’re absolutely right! mdBook wants Ace as an optional dependency. And this changes some things, because the way playpens are right now, I will not be able to integrate Ace into them (due to hljs collision). It will have to be added separately, perhaps as another type of playpen entirely.
Originally, I wanted to fully integrate it to basically keep it in line with how existing playpens work and avoid duplicating functionality.
I was also hoping to let the user basically just set the config value and get editable code, without having to worry about what it looks like or how it runs code. I can still sort of do this, but I’d have to basically grab RBE’s CSS and JS and make it accessible to mdBook (and/or merge it with existing stuff). Otherwise, the user will have to provide the JS and CSS themselves, and that just doesn’t seem useful.
The other but perhaps more minor part is styling. RBE playpens look very different from current mdBook playpens. Large buttons vs small icons. hljs is actually part of that but of course if I put it on top of Ace, Ace will stop working. Maybe this will just be some style debt we live with for a bit.
I’ll have to look deeper into how testing happens. The only thing I’ll ask here: RBE currently uses syntax like {hello.play}, and then some script (I presume, I don’t think I ever found it) looks for those and generates a few divs with Ace and playpen runner.
So I may do something very similar here, but I was wondering how important the {file.play} syntax was to you? Can it just be the raw code inside of ```rust, editable``` or something? Do you have a preference? I think mdBook actually supports referencing files as well (syntax may differ), but inline code seems more standard and I wanted to check how important this is.