Allow a new anonymous example to be opened with code provided (encoded) in URL arguments?


#1

I am working on a Wiki Generator for GitHub which generates a Markdown Wiki based on code comments (https://github.com/th317erd/gh-wiki-gen). In the generated documentation for a project I allow for code examples to be dumped into the documentation. I would like to be able to add a “Run this example using RunKit” link, but I see no way to currently do this, and because it is Markdown, no scripts, iframes or anything “dangerous” is allowed (meaning embed is out of the question).

Could RunKit add an “anonymous” “example” page where the code for the example is passed base64 encoded in the URL args? Being as this is coming from a wiki hosted on GitHub it can’t really have a user attached to it (easily) and I see no way to currently pass code to a blank example page.

Thank you!


#2

This would take a bit of thinking on our end, but until then, I’ve made this RunKit endpoint which hopefully should suffice:

You call it with the base64 just like you requested, so for example the code “5+5” is available at:

https://runkit.io/tolmasky/base64-runkit-code/2.0.0?code=NSs1