Pull requests / #1228

#1228 serve: list items separated by blank lines are one list, and a list continued later keeps its numbers (#671)

open · @BGonnermann · 0 评论 · 在 GitHub 查看

Server & APIWindows

描述

Fixes #671.

Blank lines between list items currently split an ordered list into several `<ol>` blocks, each numbered `1.`. Keep items of the same kind in one list across blank lines. A list resumed after a code block or paragraph starts at its written number, including `0`.

Skip each run of blank lines once. The original implementation rescanned the remaining run for every blank line and could stall chat rendering. The new regression test times out on that implementation and passes after the repair.

Validation on Windows 11, Python 3.14.7, and Node 24.19.0:

- `python -m unittest serve.test_web_markdown -v`: four tests pass. The two original list regressions fail on unmodified upstream `d5ea713`.
- `python -m unittest discover -s serve -p 'test_*.py' -v`: 456 tests, OK, six skipped in the normal Windows user environment.
- Actual Chat UI with the HTTP/SSE mock engine, Playwright 1.63.0, and Chromium 149.0.7827.55: loose ordered and bullet lists, steps separated by code fences, and starts at `0` and `7` render correctly. Desktop 1280x1400 and mobile 390x1400 screenshots inspected. No browser page errors.
- A run of 100,000 blank lines between two list items renders in 2.6 ms in Chromium. The Python/Node test gives that case a five-second deadline.

Indented paragraphs remain separate paragraphs between lists, as described in the original PR. No new Markdown syntax is added.

站内延伸阅读

链到安装、模型与版本说明,便于 SEO/GEO,非官方 issue 正文。