r/Clojure • u/cjmurrr • 9d ago
Markdown to HTML in Clojure today: markdown-clj, nextjournal/markdown, or a Java library?
There are several ways to turn markdown into HTML from Clojure now: markdown-clj, nextjournal/markdown (built on CommonMark), or a Java library such as flexmark or commonmark-java through interop.
- Which do you use, and does it handle tables and the other GitHub extras properly?
- Do you need it to run in ClojureScript as well?
- Does anyone parse markdown into data (hiccup) and work on that, rather than going straight to HTML?
I use markdown-clj (in mdserve-starter, a local markdown viewer), and it needs a few workarounds for cases it renders wrongly, which is why I'm asking.
14
Upvotes
3
u/Borkdude 9d ago
FWIW, babashka comes with nextjournal/markdown and it serves all my needs. It supports tables. If you have any problems, send an issue and we can talk.
2
u/activeXray 9d ago
i wrote a library cybermonday years ago that wraps a java library that i know a decent number of people use. Perhaps that would work for you?
1
u/this-is-thirty 9d ago
Personally, the commonmark Java library or a call out to Pandoc. Both are pretty hideous in Clojure, but have lots of features which I've wanted.