fix(slack): keep blank-line-separated ordered items in one rich_text_list

When a Markdown ordered list has blank lines between items (common in
LLM-authored content), the list run loop breaks on each blank line.
Slack numbers each rich_text_list independently, so N items produce N
lists each starting at 1.

Skip blank lines inside the list run as soft separators instead of
breaking, so ordered items stay in one rich_text_list and Slack renders
the correct numbering.

Fixes #57076
This commit is contained in:
liuhao1024 2026-07-02 21:48:53 +08:00 committed by kshitij
parent 3a122ba4ac
commit d3c8a155cb
2 changed files with 20 additions and 0 deletions

View file

@ -451,6 +451,10 @@ def render_blocks(
indent, ordered, txt = items[-1]
items[-1] = (indent, ordered, txt + " " + lines[i].strip())
i += 1
elif not lines[i].strip():
# blank line — soft separator within a list run;
# skip so that ordered items stay in one rich_text_list.
i += 1
else:
break
blocks.append(_list_block(items))