<- leave the wiki or go home

ccalathea

Tags: projects

This project has been deprecated in favour of calathea

ccalathea is a small static wiki generator written in C. It's also the backbone of the website you're browsing right now. ccalathea tries not to accomplish too much, focusing on doing a few things well. Things it does to varying degrees of wellness include:

ccalathea is the first complete project I've ever taken on entirely in C as a part of my quest A) to roll more of my own tooling and B) to get away from the encroaching wave of software written in JavaScript that won't run well on my aging equipment.

Usage

If you just run calathea in your terminal, it'll search for a folder named ./pages and a template file named ./template.html. The ./pages folder contains files written in Markdown to be rendered. This folder can be configured with the --src flag. Similarly, the template file can be configured with the --template flag.

As of version 1.0.0-beta.1, your template file can contain a few pseudo-Moustache templates:

The first line of each source file is the name of the page, as it can be wikilinked to. The rest of the page is the content that gets spliced into the template. For example,

Page Title This is some content.

If this were the content of a file in your source directory, then it could be wikilinked to by writing [[page title]]. Note that page titles in wikilinks are case-insensitive.

How it works

The build process is fairly straightforward:

  1. All the source pages are collected and stored in the memory as a linked list
  2. The list is traversed for edge processing. Each page in the memory maintains a dynamic list of all pages linking to it. When a new page is discovered to link to it, that page gets added to its incoming list. At this point, wikilinks are rendered to standard Markdown or HTML links
  3. The list is traversed again, this time searching for the pseudo-Moustache templates in which to splice important content. The final renders are then stored in the build directory.

For this to work, we need to be able to efficiently get a pointer to a page in the memory given its title. To do this, ccalathea also maintains a hash map using a polynomial hash function and implementing open addressing.

Deprecation

In August 2023, I decided to rewrite this project in Rust. My reasons for doing so were:

This project was originally called calathea, but the rewrite took the name and this project was renamed to ccalathea.