markdown.renderer.utils.loose_break_needed

markdown.renderer.utils

loose_break_needed(list_stack, container_depth) -> needed

Decide whether a loose list needs a blank line before its next block

Records the block against the innermost open list and reports whether a blank line has to precede it. Loose spacing is emitted before a block rather than after one, so the last block of a list never picks up a trailing blank of its own and the first block of a list never gets a leading one.

Only blocks that are direct children of a list item count. container_depth is the caller's current div plus blockquote nesting, compared against the nesting the list was opened at, so a paragraph inside a blockquote inside a list item is left alone.