3 ms·
Literate.jl comes close. You maintain a file README.jl, with a mixture of Markdown text, example code in Julia, and hidden code in Julia. Inspired by Knuth's
by thisrod 6y ago
Literate.jl comes close.
You maintain a file README.jl, with a mixture of Markdown text, example code in Julia, and hidden code in Julia. Inspired by Knuth's literate programming idea, there are several things you can do with that file:
* Weave it to get README.md, with the text, the example code, and the output from running the example code.
* #include it in your tests, to run the example code, then run the hidden code to verify the results.
* Super-weave it to generate a web notebook, where people can modify the example code and see what happens.
This isn't perfect. When the examples generate graphical output, you have to write some boilerplate code to capture it as a GIF and link it in README.md. That gets annoying in a numerical language like Julia. But it's pretty good.