Issues / #671

#671 serve: ordered lists whose items are separated by blank lines render every item as "1."

open · @kdmcser · 0 comentários · No GitHub

Server & APINVIDIA / CUDAModels & quantsWindows

Descrição

## What happens

<img width="2212" height="916" alt="Image" src="https://github.com/user-attachments/assets/4cff382b-8540-4c6a-b761-30a5ecf16e26" />

In the Chat tab an ordered list comes out with every item numbered `1.` when the model puts a blank line between the items — a normal Markdown "loose list".

The model's answer is valid Markdown:

```markdown
1. **Keep a regular schedule**
   Go to bed and get up at the same time every day.

2. **Optimise the bedroom**
   Quiet, dark, 18-22 C, a good mattress.

3. **Cut screen time before bed**
   Blue light suppresses melatonin.
```

but the page renders `1.` / `1.` / `1.` with a paragraph-sized gap between the items.

## Why

`serve/web/app.js`, in `blocks()`:

```js
if (!l.trim()) { flushPara(); flushList(); continue; }
```

A blank line closes the list unconditionally. When items are separated by blank lines, every item therefore becomes its own `<ol>` containing a single `<li>`, and the browser numbers each one `1.`. CommonMark keeps blank-line-separated items inside one list (a loose list), so this is a renderer bug, not a model-output problem — it shows up with any model that puts a blank line between list items.

## Fix

Keep the list open across a blank line when the next non-blank line is another item of the same type:

```js
if (!l.trim()) {
  flushPara();
  // a blank line between list items keeps the list open (Markdown loose list);
  // otherwise the list ends here
  if (list) {
    const nxt = lines.slice(i + 1).find((x) => x.trim());
    const itemRe = list.tag === "ol" ? /^\s*\d+[.)]\s+/ : /^\s*[-*+]\s+/;
    if (!nxt || !itemRe.test(nxt)) flushList();
  }
  continue;
}
```

A list followed by a paragraph, a heading, a table, a blockquote or the end of the message still closes exactly as before, so nothing else changes.

## Verified

Applied locally; the same answer then renders as a single `<ol>` with three `<li>` and shows `1. 2. 3.` (browser-native `decimal` numbering, no custom counters or `::before`).

## Environment

- Strata v0.1.38, commit 99f3dbd0b21d1401b3769e0c0d963913607f380b
- Windows 11 26H2 (build 26300)
- RTX 5090, Qwen3.8-Flash-Next **IQ3_S**, context 131072
- Chat tab, Chrome

---

*Reported by an **AI coding assistant** (an agent working in the user's editor), at the user's request. The reproduction, the cause, the patch and the verification above were all done on the user's machine before reporting; a human reviewed the report before it was filed.*

No site

Links install, modelos, releases.