I started a blog (https://juliohm.github.io) where I am planning to use Julia for my examples. GitHub Pages and Jekyll are the recommended tools by GitHub and many people from the R community have developed plugins for running R code directly when the website is built:
I wonder if someone knows how to get Julia code working in a similar way, that is, I could write a snippet of Julia inside of a block like
```julia
```
and have the block and results printed on the webpage.
3 Likes
AFAIK Nikola, another static site generator, works with Jupyter notebooks.
1 Like
You could also use Weave with a custom template.
2 Likes
Is there an example that integrates Hugo with Weave.jl
for blogging?
Not that I know of. Probably the easiest way is just to convert to from .jmd
format to markdown. There is a script for calling weave
from command line https://github.com/mpastell/Weave.jl/blob/master/bin/weave.jl so that’s easier to use with Makefiles (although I need to update it to support all current input parameters, feel free to open an issue to remind me if you want to use it and something is missing).
Thanks, I opened an issue. But I don’t insist on Hugo, so if there is an example of how to get Weave.jl
to work with any static site generator (eg Jekyll) it would be useful.
Thanks for sharing Weave @mpastell, I think it is my best bet. I have to figure out how to run it and paste the HTML in place. Also wondering how to make it work with GitHub pages, if I need to install Julia there too.
@mpastell, Jekyll supports plugins in case we need to add one for Weave there. Do you have experience with it?
Figured it out with Hugo. Will work out the quirks and make it public soon.
4 Likes
If someone can figure out a solution with Jekyll, that would be highly appreciated.
@oxinabox has a Jekyll blog which has syntax highlighting. You might want to look at his repo.
If there’s a way to use GeSHi with Jekyll, then a version of this would work.
Thank you @ChrisRackauckas, my main concern is the output, I will see if someone has written a Jekyll plugin for that, I remember finding one for TiKZ that basically runs pdflatex and puts the output in HTML: https://gist.github.com/hack-ghost/6139753
Maybe we could adapt it to run Weave.jl instead.
You can use something like this to transform Julia code from Jupyter notebooks to HTML, and use that?
https://github.com/ChrisRackauckas/JupyterSite
But something from Weave.jl would likely be more elegant.
FYI, the output that comes out of this is quite horrid. The Jupyter auto-conversion creates some pretty nasty HTML and LaTeX to do it’s coloring, so I’d only use it if it’s copy/pasted
Thank you @ChrisRackauckas, I am really hoping to find a cleaner way, maybe I should ask in Jekyll discourse…
It is awesome, and definitely better than what I have now, I was just wondering if we could make it literate: write the code and get the result in HTML directly. @oxinabox solution is pasting the output manually, I think I will go with it.
I imagine that also with Jekyll you can write your code in literate .jmd
files, with YAML front matter, call weave.jl
to generate the .md
files, and then use jekyll
to generate the static pages. That’s my workflow with Hugo, the hard part was dealing with the paths of generated plots.
This is how my Julia code is looking like:
The syntax isn’t quite right and I can’t have the output generated automatically
1 Like
Nice blog post! Maybe you can extend it to give an example of the continuous-time process?