Wow, that鈥檚 a lot of stuff.
It鈥檚 good to record all that here, but in the interest of doing one thing at a time, I鈥檓 going to try to focus on the requirements for the editor:
[quote=鈥渕dinger, 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鈥檙e 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鈥檇 have to basically grab RBE鈥檚 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鈥檛 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鈥檒l have to look deeper into how testing happens. The only thing I鈥檒l ask here: RBE currently uses syntax like {hello.play}, and then some script (I presume, I don鈥檛 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.