Can I post executable content using JS?

First-time user exploring Medium for blogging.

Being able to generate executable documents as literate programming is very important to me. Let’s start with a simple example adding two numbers.

It looks like Medium allows for that as an embedly solution that brings in snippets from jsFiddle. This is done by embedding a link composed without the username or the version number, something like https://{url_of_the_fiddle}/show/embedded/. For example, this jsFiddle I wrote to add two numbers, at https://jsfiddle.net/jonasalmeida/nsrj4ovr/, was added here (left, give it a try) as https://jsfiddle.net/nsrj4ovr/show/embed/. Note that this requires forking the final version of the fiddle as it wont allow the use of version numbers in the url composite.

Some issues with this solution, the main one being the lack of tools to control de size of the snippet (anyone?). Let’s try the single-page app now, borrowed bit.ly/pqiSuffolk from https://www.ncbi.nlm.nih.gov/pubmed/26958160 (which can also be embedded directly, as shown below).

First, I tried to embedd the link directly, https://mathbiol.github.io/openHealth/index.html?jobs/pqiSuffolk.js, and it did not work. Next, I tried to embed it from a jsFiddle snippet, as above, and it did work (below). Note how first time visualization of the App, particularly on a cell phone, takes a couple of minutes to retrieve the live data from NY’s Dept of Health. It did feel a bit slower than rendering the same data directly from a shortcut such as bit.ly/pqiSuffolk.

interactive map (click on it!) of preventable diseases in Suffolk county, Long Island, NY

Conclusion, Medium allows embedding of live JS components packed as jsFiddles, but it is itself not configured as a literate programming platform. I am very impressed by recent interactive publishing platforms such as https://distill.pub, and would be delighted to hear about consumer-facing suggestions in the Responses section below.