{owpe {main, rss/atom, github, oven} yamada[at]riseup[d]net ;}
word count: 586

2023-10-06T03:04:38UTC

hello world: about this place

put stuff together

This is a site written in extended[1] common markdown and parsed[2] into html, served via a Cloudflare R2 public bucket as a static site if nothing has changed when this note is published.

markdown to html

The toolchain was learnt from this post. We need npm and Node.js, along with the following packages: markdown-it, highlight.js, footnote plugin of markdown-it, attrs plugin of markdown-it, mathjax plugin of markdown-it. Installation:

# on node v18.15.0, npm 9.5.0
npm install --save markdown-it highlight.js markdown-it-footnote markdown-it-attrs markdown-it-mathjax3

The conversion part has little non-default settings. The code looks like:

var mdit = require('markdown-it');
var hljs = require('highlight.js');

// (some hard-coded html head here)

md = new mdit({
    highlight: function(str, lang){
        if (lang && hljs.getLanguage(lang)){
            try{
                return  hljs.highlight(str, {language:lang,
                                        ignoreIllegals:true,
                                        }).value ;
            }catch(__) {
                console.log('wut');
                return md.utils.escapeHtml(str);
            }
        }
    }
}).use(
    require('markdown-it-footnote')
).use(
    require('markdown-it-attrs')
).use(require('markdown-it-mathjax3');

// (read md, process md + update peripherals and finally write html)

Sidenotes:

RSS/atom and delivery

The RSS advisory board has a RSS/atom validator. Before reading the specs, i worried about mismanaged timestamps might confuse aggregators, but seems deduplication is via id/guid which is more sane. I don't know much about the difference between RSS and Atom specs, the choice is arbitrary except for my preference to contain full texts in the feed. One unexpected problem is that the css-based text modification breaks down here, since css is absent from the feed.

Creation timestamps are manually written along with texts, and update timestamps are updated when a markdown re-parsed into html. The feed xml is assembled by a dumb python script, and uploading to R2 is a equally dumb bash script, in other words, human-powered. We will see how human errors balance against a more automatic workflow.


  1. To allow classes, identifiers and attributes. ↩︎

  2. Jekyll or Hugo was not used because they are more powerful than what i'd need, and creating glues seemed easier than RTFM. ↩︎