Hello World
When starting this blog, I tried out various markdown-to-html static site generators. As all developers do, I found something wrong with each of them, and what you see before you is the result of Yet Another Markdown Blog syndrome.
To make it interesting, I've decided to try and optimise for memory usage.
First, a visitor function lists each markdown file under the markdown directory, recursively. Each filename is output through an AsyncGenerator function.
That function is the input to a pipeline class. That pipeline handles passing the value through successive AsyncGenerators. This gathers metadata about the file, parses it through markdown, renders the markdown into a template, formats that html through prettier, and scans for broken local links. It also allows for running a 'scan' over the data as it is being generated, to allow collecting data about the set without storing the whole set in memory.
For example, if you visit the index file of this folder you will see an index file, which was generated by checking when the visitor function moves to a new directory, then outputting all the files we've seen in the current directory to an index.html file. You probably clicked from the homepage, which is also lightly templated to include the recent posts links.
And because I'm a programmer and I can't help myself, I wrote my own stupid-simple template processing engine, which is only one step above string-replacement. It does however tell me exactly which keys are missing for a given template, and which were provided by the pipeline, to help me diagnose issues.
It is still not in an ideal state:
- unit tests? what unit tests? 😅
- there is a config object, but it is hard coded...
- the rss generator does technically use unbounded memory because it keeps all 'items' in memory until writing the final file
I'd like to tidy this up a bit and publish it to a git repository soon though. More to follow soon(ish)...
Update
28 Dec 2025
Config moved out of constants and into json file