Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed images in gorilla-repl?

Tags:

clojure

Is it possible to embed image in markdown cell in gorilla-repl?

I would like to keep images in src folder in the root of leiningen project and be able to embed images into my worksheet with:

![plot 1](img/plot_1.png)
like image 599
libnull-dev Avatar asked Apr 10 '16 17:04

libnull-dev


Video Answer


1 Answers

This does not look possible using the envisioned incantation.

The markdown implementation looks to be done in the browser in javascript, using codemirror, which for security reasons does not have the ability to load resources from the local file system when the origin is http://localhost.

It can, however, load resources over http, so using an http url for the resource in the markdown expression works.

One could conceivably teach gorilla to listen on a route that resolved to the src/ or resources/ directory on the local file system, but that would break if the worksheet were shared.

There would need to be a mechanism to turn the image data into a data:// url (with all the requisite limitations that entails) so it could be packaged with rendered worksheet html.

like image 51
Jonah Benton Avatar answered Oct 07 '22 03:10

Jonah Benton