nextjournal 2023-02-06

using nextjournal/markdown, is it possible to pull every consecutive paragraph into a section? e.g.

p1

p2

p3
should become
[:section
 [:p "p1"]
 [:p "p2"]
 [:p "p3]]
I would like to style consecutive paragraphs as a single block, but it is hard to accomplish with the defaults which produces a div containing a flat list of elements.

you can maybe write <section> around those ?

@borkdude perhaps, though that doesn't solve the general case.

I think you’d need 2 steps, first “postprocess” markdown data as returned by nextjournal.markdown/parse, wrapping consecutive paragraph into a {:type :section :content [...]} node, preserving the same nested structure.

then you’d add a :section type to the map of the “renderes” like described in https://github.com/nextjournal/markdown/blob/f3e40c37d312b0bd964cfe1660b3dd42a0f3068d/README.md?plain=1#L104-L114 (see https://nextjournal.github.io/markdown/README.html for a clerk notebook rendering results)

this way, I believe, should be easier than postprocessing the hiccup data itself, but it’s certainly not the only way to do it...

Thank you for the guidance @andrea712. I'll take a look at it.

👍 1

I can postprocess the result myself, but I would rather use the rendering options in the library, though I have a hard time figuring out how they work.