Website via Franklin.jl from Pluto.jl notebooks

I have a collection of Pluto.jl notebooks that I’ve been putting together for solving science problems using SymPy.jl. The collection of notebooks is a git repo with a Project.toml and Manifest.toml. I want to turn these Pluto.jl notebook files into a static website using Franklin.jl and deploy them to the repos github-pages.

Conceptually I see how things should go, but I’m not sure how to execute the workflow to make it work. What should the layout of the repo? Also seems like I need to use Literate.jl however I don’t think it is compatible with the markdown used by Pluto.jl.

Any ideas are much appreciated!

1 Like

@fonsp buit a great interactive website with Pluto:
https://computationalthinking.mit.edu/Spring21/week1/

Maybe something like this would also be an option for you.

1 Like

I’m not very familiar with Pluto but since it can generate (or is backed by) raw Julia files, these can be used as base for Franklin.

Effectively all you have to do is write a Julia function that « parses » the Pluto script and is able to separate the Julia code cells (and fence them with ```! ... ```) and strip the rest from the symbols that Pluto uses to denote text. This function can then become a « lx fun » that you would call like \pluto{path/to/file} in a markdown file (similar to the literate command)

That function will inject the markdown that Franklin will handle, the back ticks and exclamation mark will inject the code, run it and inject the result. (And when you push to GitHub it’ll do the same, assuming your environment is specified properly)

I can help you build a small poc for the function mentioned above if you’d like, feel free to open an issue on Franklin and we can discuss that further there

(Ps: the base of the site computationalthinking is made in Franklin btw :grinning_face_with_smiling_eyes:)

3 Likes

I had a bit more of a look, it seems that GitHub - vdayanand/Jupyter2Pluto.jl has a pluto2jupyter function that allows to convert a Pluto script into a Jupyter notebook (I haven’t tried) but so if you can do that then you can go one step further and go from Jupyter to Literate (e.g. via GitHub - oxinabox/ipynb2LiterateJulia: NBConverter stuff to convert Jupyter Notebooks in to Julia Literate.jl files (This is the opposite of Literate.jl)) and then you wouldn’t have to code anything yourself.

@tlienart thanks I think I’ll give this route a try first.

Thanks for the reference, this will help me think about how to do things.