I haven't actually done it myself, but there seems to be two general approaches: generate the DOM "programmatically using karax or just interfacing with the HTML DOM as you seem to be trying to do.
Using dom would seem to be pretty straightforward following what one would do in JavaScript: just getElementById which returns an Element, which contains a contentEditable as a cstring and if that was (say) a text element, I would say you could just set that to whatever you wanted to show.
One if these days I'll get around to actually trying this, but I'm pretty sure something along this line will work.
Thank you so very much for this!
Also, I would do WebAssembly but the process seems a lot more complicated, so I'll wait until it gets proper support, official or not. Any news on that?
@dotheda:
Also, I would do WebAssembly but the process seems a lot more complicated, so I'll wait until it gets proper support, official or not. Any news on that?
I don't know about official support, but it has been done often enough, even by @Araq, although many users are on Linux and there is a bit of a twist required for use on Windows. As I am on Windows, I explored this, with the results as per my forum post here.
As mentioned in that post, it works well, but adds a bit of a level of complexity in that you can no longer use the dom library directly from code and will likely have to call into the HTML DOM by using emit of JavaScript code if doing it from "asm.js" or by building two dependent projects when using WebAssembly, with one producing the JavaScript and the other producing the WebAssembly; alternatively, one could produce the required minor JavaScript "glue" code just in JavaScript using the produced HTML "runner" code as an example.
It doesn't look to be that hard and I'll likely be doing something along these lines shortly.