This is probably a bit of a strange blog post, but I wanted to document it here because it's related to the blog itself, and I'm going through a bit of an internal decision crisis. You see, the blog you are reading is actually written in pure Markdown. If you have any experience with the antiquated Blogger platform, you might be asking, "Uh, how?" Well, it turns out that it's pretty simple to convert Markdown to HTML. A while back, I decided to write1 a python utility/script to help me do this2. In my specific Blogger template, I have some JavaScript code and libraries to allow for code highlighting and $\LaTeX$ equation rendering via MathJax.
But how do I get these blogs, once converted to HTML, onto Blogger, you may ask? Well, the easiest route is to just copy and paste the HTML code into a new post via the HTML editor. This is clunky and old-fashioned, so I wanted something a bit more programmatic and took a deep dive into the rabbit hole of Google's APIs. It turned out that they do support Blogger API calls, and there is a Python library to do so. I was thus able to make the conversion and uploading of my markdown blogs pretty straightforward. There are a few things like not being able to set the labels, so this still needs to be done manually. I also only upload as a draft, but the API does let you upload to publish.
So, what about figures or graphics? Well, this is where I borrowed an idea from Pluto.jl notebooks. If you've ever saved these notebooks to HTML, you will find that they encode the images into base64 strings, which are easily decoded by your modern browser. This does have the downside that the HTML files are large, but so far, Blogger doesn't seem to care, other than some posts take a few seconds to load. Here is an example figure that was inserted via Markdown:
Funny markdown comic |
Now, I probably should have opened this blog post with the fact that not many, if any, actually read my blog – that's okay; I set it up mostly for my own personal use – but those who do would immediately probably ask, "Why are you still using Blogger? Why not use a static site generator?" For which I say, yes, I know, and this is what I'm struggling to decide over. Initially, I remained loyal to Blogger because I spent a good amount of time learning some HTML and JavaScript to get the look and feel the way I wanted. The thing is, now with LLMs, it's much easier to style and set up a new blog. Furthermore, almost every static site generator uses Markdown and has really good extensions and support for the features I like to use, for example, footnotes, $\LaTeX$, references. I'm just hesitant, but we will see. One idea I have is to use Quarto to write my blog posts, but also actually have multiple blogs on a single site. This might be interesting because I could have a blog that just contains posts on my opinions on science policy and then a blog that focuses on technical topics; but maybe this is just for my liking and doesn't make much of a difference for potential readers.
So, I am at a dilemma. I have my Blogger blog set up to my liking; it works most of the time as I anticipate, and I do go back to older posts to refresh my memory on things. I've found it to be very useful for posts I can re-read3, and because this is public-facing, I somewhat have to put in much more effort to ensure the quality and presentation is higher than if I just take notes that no one will ever see.
Footnotes
-
As most these days, with the aid of LLMs. ↩
-
The utility script is very much tailored to the type of markdown flavor I write and is not really designed to be used as a general-purpose markdown to HTML converter. ↩
-
The other way I do this is to use Obsidian, which creates a web of knowledge for you based on your notes, and you can turn it into ↩
No comments:
Post a Comment
Please refrain from using ad hominem attacks, profanity, slander, or any similar sentiment in your comments. Let's keep the discussion respectful and constructive.