babashka

teodorlu 2025-08-16T10:44:15.451429Z

Prompted by a https://clojurians.slack.com/archives/C053AK3F9/p1754141186080849?thread_ts=1754131514.543399&cid=C053AK3F9 on #beginners, I wrote a little starting point for publishing Org-mode files on the web from a Babashka or JVM Clojure process: https://github.com/teodorlu/bb-org-example Note that this is less feature rich than Michiel's own https://github.com/borkdude/quickblog: No RSS, less pretty index, no tags support, no post previews — but it does let you write Org-mode. The heavy lifting of Org-mode to HTML conversion is done with Pandoc, which is a required dependency.

🎉 3
borkdude 2025-08-16T11:43:04.236939Z

I've been thinking about a pandoc pod. that would at least cut the startup time of pandoc. how quick is it to convert one document using this code? https://github.com/teodorlu/bb-org-example/blame/master/src/bb_org_example/pandoc.clj#L121-L127

🙏 1
teodorlu 2025-08-16T12:01:52.820239Z

Without a pod: slower than I'd want. For short org-mode strings, process startup overhead dominates the total runtime (from previous benchmarks I've run). At the phone right now - I can give you some hard numbers when I'm back in front of a computer.

borkdude 2025-08-16T12:02:16.014169Z

sure, no hurry

teodorlu 2025-08-16T16:38:08.850799Z

It appears the shellout tax is about 30 ms per call to pandoc.

teodorlu 2025-08-16T16:59:27.472239Z

I measured the conversion of all org-files on my site with the same code, and saw conversion times from 64 ms and up. The code shells out to Pandoc twice, first to convert from org-mode to Pandoc JSON, and then to convert back from Pandoc JSON to HTML. Full results: https://play.teod.eu/pandoc-shellout-tax/#results

borkdude 2025-08-16T18:06:56.311069Z

can't you go straight to html?

teodorlu 2025-08-19T08:37:53.313609Z

I removed the pandoc indirection — now I just shell out once to pandoc. It wasn't helpful to the goal of briefly helping someone getting started with a small Org-mode powered site. Thanks for good questions!

teodorlu 2025-08-18T08:17:46.748249Z

You can! pandoc --from org --to html --standalone. I've previously needed to do things on the intermediate JSON, eg infer post title, extract the first paragraph and read links, but in this code it's not strictly necessary.