Source code: <https://github.com/ZoomTen/nailit>
Example using its own source: <https://zoomten.github.io/nailit/> * * * This is a minimal tool for [literate programming](https://en.wikipedia.org/wiki/Literate_programming), a way of programming that seems to best be described as "pretend you're writing a tutorial on how to write your program". And by that I mean literate programming in a Knuthian sense, in that you can write your program in the order that makes most sense to a reader and then the tool can process it into something that can actually compile. This is in contrast to the more modern definition using e.g. Jupyter notebooks where each code block is self-contained and usually meant to be run one after another, but most importantly _cannot actually reference one another_. (`runnableExamples` seems to be a different thing entirely) Knuth's literate programming concept remains interesting to me even when it's impractical for me to maintain such a program (generally due to not meshing well with syntax highlighters and language tooling). I have written [at least one guide](https://zoomten.github.io/PongBoy/_book/PongBoy_contents.html) with this concept and I had fun doing it. (though, I still don't know whether or not it's actually helpful to people) Similar tools I already know of for this sort of thing: * The O.G. WEB and its derivatives [CWEB](https://www-cs-faculty.stanford.edu/~knuth/cweb.html) and [noweb](https://www.cs.tufts.edu/~nr/noweb/) * zyedidia's [literate](https://zyedidia.github.io/literate/) which is a bit more modern, but still closely modelled after WEB * Justin Meiners' [srcweave](https://github.com/justinmeiners/srcweave), which is more straightforward but its format is based off the one used for `literate` Reasons I wrote my own tool even though it's less capable than those other ones: * For fun * I want my literate programs to be easily read by existing Markdown renderers * I want less "refer to section numbers a code block is in" and more "refer to code blocks directly" in my output * Writing more Nim for the hell of it I originally contemplated plainly using `nimlit` as the program's name, but I thought: Nah, I don't think I want to give people the wrong idea that it can only be used with Nim though it _is_ written in it :p