decode-elements with decode-paragraphs inserts spurious <p> when nesting lists?
As in this example:
> (decode-elements '("Things to buy" "\n\n" (ol (li "Food" (ul (li "Milk") (li "Eggs") (li "Broccoli"))))) #:txexpr-elements-proc decode-paragraphs) '((p "Things to buy") (ol (li (p "Food") (ul (li "Milk") (li "Eggs") (li "Broccoli")))))
<p> tag wrapped around
Food doesn't need to be here. Fixing this behavior doesn't sound trivial, though.
The result is a little surprising, but it’s consistent with the documented behavior.
"Food" is adjacent to a
ul, so it gets a
p tag. There are different ways you could solve this. Adding
#:force? #t to
decode-paragraphs will make it consistent.
One quick and dirty option to circumvent your problem is removing
ol from the
block-tags list. Of course that will then turn the behavior off everywhere, but I have found that it doesn't really casue issues for me (yet).
(module setup racket/base (provide (all-defined-out)) (require pollen/setup) ;; treat lists as run-in text (define block-tags (remq 'ol (remq 'ul default-block-tags))))
Deleting a branch is permanent. It CANNOT be undone. Continue?