Blog Home

Starting a Blog

May 01, 2025

I've been writing these blogs posts as Markdown files with the intention of turning them into a blog. Well, today is that day! I eventually want something that's fairly feature rich (a page for each blog post, ability for users to login and comment, ability to subscribe via RSS, etc) - but for the first cut, all I want is a single static HTML page to display my posts in reverse chronological order (newest first).

The first thing I need is the ability to convert markdown files into HTML, which is simple with the python markdown module. It did take a little work to figure out how to properly render things like triple-tilde quote blocks - for that, I needed to specify some extensions arguments to markdown (specifically, the fenced_code extension). I found an officially supported list of extensions here.

I also needed to be able to insert the posts into a larger HTML page. For that, I have a simple solution which wraps each post in a simple HTML wrapper, and then combines all of those together into one string and inserts it into a template HTML page. I'm familiar with Jinja2 for this type of templating, but for the first cut I just went with basic <str>.replace() syntax.

Finally, I wanted to strip out the title and date of the posts to be able to print them with special formatting. I used a simple heuristic for this - the title is the first level-1 (single #) heading in the markdown, and the date is just the name of the file. That naming also makes it easy to print the pages in newest-first order when reading in the markdown files.

Had plenty of help from ChatGPT on this, and it's far from done, but I'm happy to have these posts up and available for friends and colleagues to follow me on my journey!