i <3 htmx
I've started using htmx to render posts. I'm doing this by rendering a markdown post into HTML using Python, which I directly inject via an Ajax event on page load.
This has been something I didn't realise I wanted since I started hosting my own website. Not that I'm against using React or other JS frameworks — but wrapping megabytes of dependencies for a site like this, which I always wanted to be lean and load quickly, seemed like a huge waste.
import markdown
with open("post.md") as f:
content = markdown.markdown(f.read(), extensions=["fenced_code", "codehilite"])
print(content)
This method only involves importing an 18kb dependency that enables exactly what I want to do. The HTML is server-rendered, the page loads instantly, and there's no hydration step, no virtual DOM, no bundle to ship.
For a personal site — a few static pages and some blog posts — the complexity of a full JS framework is genuinely not worth it. htmx hits the sweet spot: you get dynamic content loading without sacrificing simplicity.
Now to support all the markdown features in CSS!