@@ -416,7 +416,8 @@ capitalize = walk go
416416 go x = x
417417
418418-- | Change final list item from @Para@ to @Plain@ if the list contains
419−-- no other @Para@ blocks.
419+-- no other @Para@ blocks. Otherwise (if the list items contain @Para@
420+-- blocks besides possibly at the end), turn any @Plain@s into @Para@s (#5285).
420421compactify :: [Blocks] -- ^ List of list items (each a list of blocks)
421422 -> [Blocks]
422423compactify [] = []
@@ -426,9 +427,15 @@ compactify items =
426427 (Para a:xs) -> case [Para x | Para x <- concatMap B.toList items] of
427428 -- if this is only Para, change to Plain
428429 [_] -> others ++ [B.fromList (reverse $ Plain a : xs)]
429− _ -> items
430+ -- if other Paras, it's a loose list, change
431+ -- all Plain to Para
432+ _ -> map (fmap plainToPara) items
430433 _ -> items
431434
435+plainToPara :: Block -> Block
436+plainToPara (Plain ils) = Para ils
437+plainToPara x = x
438+
432439-- | Like @compactify@, but acts on items of definition lists.
433440compactifyDL :: [(Inlines, [Blocks])] -> [(Inlines, [Blocks])]
434441compactifyDL items =