Literate programming in Jekyll posts


#1

Hi,

I am very new to Jekyll and web programming in general. I started a website (https://juliohm.github.io) where I am planning to write posts with code snippets from the Julia language. At this moment, I am copying the code snippets, running them on my computer, and pasting the output manually:

println("Hello world!") # hello world in julia

Hello world!

Is there any way, maybe a Jekyll plugin, that would allow me to just insert the code like:

{% code julia %}
println(“Hello world!”)
{% endcode %}

and get this block converted to an HTML that includes input and output automatically? That would save a lot of time and effort writing the posts. Please let me know if you have a good solution for this types of problems in another language. I know that R has a somewhat good support:


#2

Such a plugin hasn’t been written yet, to my knowledge.
Plus, it’d be a scary thing to include in a webpage, static or otherwise.

Say, a site has hundreds of posts and one of them has a block that runs and prints the user credentials from his system… someone who forked the open-source site missed that block and made himself vulnerable when his pushed his changes.

Way too paranoid… but, yes, a much benign variant can be written nevertheless.


#3

Yes, I think the world has good people too :thumbsup:, such plugin would be useful, specially if there is a mechanism for only running code if the post is updated.


#4

This is how my Julia is looking like: https://juliohm.github.io/science/coin-flipping/

The syntax highlighting isn’t quite right and I can’t have the output generated automatically :cry: