# License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
 
-BEORN_VERSION = 0.1.0
-BEORN = https://git.ladys.computer/Beorn/blob_plain/$(BEORN_VERSION):/build.js
-
 # This Makefile requires rsync 3 or newer.
 RSYNC = rsync
 RSYNC_FLAGS = -Oclmrtvz
 GIT_FORCE =
 
 build:
-       deno run --allow-read=. --allow-write=. $(BEORN)
+       deno run --allow-read=. --allow-write=. ./build.js
        touch .grass
 
 ensure-build:
 
 ensure-clean:
        @if output=$$(git status --porcelain) && [ ! -z "$$output" ]; then echo 'Error: There are uncommitted changes!' >&2; echo 'Commit changes and run `make` before syncing.' >&2; exit 1; fi
-       @if output=$$(git status --porcelain) && [ ! -z "$$output" ]; then echo 'Error: There are uncommitted changes!' >&2; echo 'Commit changes and run `make` before syncing.' >&2; exit 1; fi
 
 dry-sync: ensure-clean$(if $(GIT_FORCE),, ensure-branch-up-to-date) ensure-build
        $(RSYNC) $(RSYNC_FLAGS) --del --dry-run --filter=". $(RSYNC_FILTER)" --iconv=$(SOURCE_CHARSET),$(DESTINATION_CHARSET) $(RSYNC_OPTIONS) . $(DESTINATION)
 
--- /dev/null
+#!/usr/bin/env -S deno run --allow-read --allow-write
+
+// Copyright © 2023 Lady [@ Lady’s Computer].
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
+
+import hljs from "npm:highlight.js@11.8.0";
+
+const processContent = (content) => {
+  if (content == null || Object(content) instanceof String) {
+    /* do nothing */
+  } else if (Array.isArray(content)) {
+    // The provided content is an array.
+    content.forEach(processContent);
+  } else {
+    for (const child of Array.from(content)) {
+      applyHighlighting(child);
+    }
+  }
+};
+
+const applyHighlighting = (node) => {
+  if (
+    node.localName == "pre" && node.childNodes.length == 1 &&
+    node.firstChild.localName == "code"
+  ) {
+    const code = node.firstChild;
+    const language = /language-(.*)/u.exec(code.getAttribute("class"))
+      ?.[1];
+    if (language) {
+      try {
+        const { value: highlight } = hljs.highlight(
+          node.firstChild.textContent,
+          { language },
+        );
+        const nodes = new DOMParser().parseFromString(
+          `<!DOCTYPE html><html><body>${highlight}</body></html>`,
+          "text/html",
+        ).documentElement.lastChild.childNodes;
+        code.textContent = "";
+        for (const node of Array.from(nodes)) {
+          code.appendChild(code.ownerDocument.importNode(node, true));
+        }
+      } catch (e) {
+        console.warn(e);
+      }
+    }
+  } else if (node.nodeType == 1) {
+    Array.from(node.childNodes).forEach(applyHighlighting);
+  }
+};
+
+globalThis.bjørnTransformMetadata = (metadata, _type) => {
+  processContent(metadata.content);
+  processContent(metadata.summary);
+};
+
+await import(
+  "https://git.ladys.computer/Beorn/blob_plain/0.2.1:/build.js"
+);