Skip to content

Behind the Curtain

Tech Stack

Posts Migration

My posts' frontmatter was defined by Hexo.
I've long wanter to batch process the frontmatter of my posts.

Before After
---
title: Ancient Near East History
categories:
  - history
tags:
  - null
toc: true
date: 2020-01-23 10:41:46
---
---
title: Ancient Near East History
description: ""
created: 2020-01-23
tags:
  - history
---

I created a tool for frontmatter processing.

As mentioned in the README, I tried selimrbd/py-obsidianmd first. But it was not flexible enough to support my flow of updating frontmatter.
I then moved to JavaScript ecosystem and wrote TypeScript right away with Bun.
I tried unified but the parsing or stringify changes the post content and it is disqualified.
Then I tried the low level vfile and vfile-matter, they don't have API for writing file so I skipped them.
jonschlinkert/gray-matter fits my purpose at first glance, but it has a full load of other issues.
Finally I moved back to vfile and used yaml for file output.

Customizing AstroPaper

Due credits must be given to Astro and AstroPaper.
Astro make a great static site generator with:

AstroPaper adopted many best practices. While I do not agree with some of its decisions, it is highly customizable. It provide me a kick start and I completed these in 4 days (part time):

Handling of tags and WikiLinks are the most tricky.
I prioritize my UX in Foam so they will have to be slugified in the website to match the URLs.
AstroPaper and remark-wiki-link have their own take on how to slugify stuffs. I have to read their code and make it the way I wanted.

I gradually added these features:

TODO

Astro

The language "abc" doesn't exist, falling back to plaintext.
The language "autohotkey" doesn't exist, falling back to plaintext.
The language "conf" doesn't exist, falling back to plaintext.
The language "katex" doesn't exist, falling back to plaintext.
The language "logstash" doesn't exist, falling back to plaintext.
The language "txt" doesn't exist, falling back to plaintext.
The language "cucumber" doesn't exist, falling back to plaintext.

Foam