jacobobryant / platypub

A publishing platform built with Biff
MIT License
65 stars 13 forks source link

Add anchors to headings in default theme posts #48

Open jacobobryant opened 2 years ago

jacobobryant commented 2 years ago

e.g. if the post content includes <h2>Foo bar</h2>, we want to transform it to <h2 id="foo-bar">Foo bar</h2>. Maybe even add one of those fancy copy-to-clipboard icons that appear on hover, like GitHub does:

image

markdown-to-html libraries often have a feature for this, but since we start with html, we'll need an html parser. In Clojure it would be pretty easy to use hickory + postwalk to replace any h1-6 nodes. However with babashka looks like we'll need to use pods? I've never used pods myself yet.