Website::new()
taps mic Is this thing on?
I guess I have a new website now. Previous attempts have been either empty, terrible, or accidentally deleted followed by me losing the sources somehow. Hopefully this one gets a better run.
The design is very minimal and honestly, quite boring, not sure how to fix that. I like that it’s simple semantic HTML. One somewhat differentiating design I have is sidenotes11 Hi, I’m a sidenote instead of footnotes because I prefer notes located close to the reference22 For printed documents and scientific articles, footnotes work well because they are put in the footer of a page and not at the end of the document. For syndication I render them as footnotes because readers probably don’t know how to render sidenotes.
I can’t stop infodumping about what happens behind the scenes, so: I wanted to use something like Typst but using Typst itself didn’t work for me (even though it can output HTML). Instead I pivoted to a Janet script that reads some markup files and outputs HTML and an Atom feed.
Markup is the fun part. I could’ve used some existing format, but that’s boring – instead I cooked up a “Lisp of markup formats”, I guess. It consists of embedded Janet expressions and text blocks (and that’s about it). Expressions either evaluate to data structures representing HTML or functions to be applied to some content blocks. It is very simple but can do pretty much anything. For example, sidenotes don’t need any special support – they are implemented by two regular functions ref and note.
Some text with \em[emphasis] and sidenote\(ref 1).
>(note 1)[Text of the sidenote with \strong[nested] markup]
>[:hr]
^^ That was a raw <hr> tag (square brackets represent a Janet tuple rather than
a content block there)
Built-in Parsing Expression Grammars make parsing really simple. Even though my markup grammar is definitely not production-grade, writing PEGs is much nicer than handwriting a parser (especially with handling things like paragraph breaks). Also the htmlgen module is great, I used the same design for making an XML serializer that powers the Atom feed.
… also, there’s Mendoza which is the exact same idea with much better execution, but I found it after finishing my markup thing and decided to stick with it.33 Not-invented-here strikes again
Anyway, conclusion. Janet is fun44 Am I technically the “Lisp guy” now?, you can read the the unhinged source code of the static site generator.
Hopefully I’ll be back with something more interesting.