platypub icon indicating copy to clipboard operation
platypub copied to clipboard

Add anchors to headings in default theme posts

Open jacobobryant opened this issue 3 years ago • 0 comments
trafficstars

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.

jacobobryant avatar Jul 19 '22 22:07 jacobobryant