kripken/emscripten-site

Suggestion: include scripts on pages

ddevault opened this issue · 3 comments

http://kripken.github.io/emscripten-site/docs/api_reference/Filesystem-API.html

Pages like this should have the things they document included on the page so I can open the console and play with them.

cc @hamishwillee . No idea how easy this would be to implement - I suspect not that easy. But it sounds cool!

Sphinx allows you to directly include HTML fragments into your page and I think that these could include compiled examples. Alternatively Sphinx can link to files elsewhere (as normal URL) or as "download links" (a link in which the linked files gets copied as-is into the documentation set).

My take on this is that including the scripts "in the page" would only be possible if they were all part of a single example - otherwise having multiple scripts presumably results in JavaScript namespace clashes. I would be far more inclined to have links to either code people can build themselves for this, or prebuilt code.

At the moment there are two links to specific tests that people can build themselves. If we want to (?) provide some prebuilt examples/test code then Sphinx can link to this.

@kripken, is there other "general" test code you recommend we provide links to for file system API?

There is test code in the test suite for the file system API, however it is spread around and not necessarily easy to read. I think it's useful if people have a specific feature they want to see in practical use, by searching for it, but not as easy-to-read complete examples.